See the following comparisons:
("a" == "a")
true
(/a/ == /a/)
false
Why do I get different results with the following expressions?
EDIT:
Now I am using just == and still getting the same results.
The literal /a/ is not a string, it's a regular expression object. No two objects are === to each other.
typeof /a/, you'll get the answer.var a = /a/; and then a === a or a == a are true.undefined, null, Numbers, Strings literals and Booleans are value types in javascript. 
So, they will be compared with their value unlike RegExp(or any other Object for that matter) which is an object, where the comparison takes place on the grounds of reference. So "a" == "a" will return true because the values are same but /a/ == /a/ will return false because the references are different.
"/a/"=="/a/"for that.