Q:

javascript test strict equality

// If you try to test if the number 5 
//is equal to the string “5” the result is true. 
var a = 5; 
var b = "5"; 
if ( a == b) --> true
//That’s because JavaScript figures out the value 
//of this string is five, and five is the same as five, 
//so therefore a equals b.

//But if you ever need to test to see 
//if two things are identical, three symbols is the way to go. 
var a = 5; 
var b = "5"; 
if ( a === b) --> false
0

New to Communities?

Join the community