Consider following code snippet:

var a = false; 
if (a == '0') { 
    alert('=='); 
} 
if (a === '0') { 
    alert('==='); 
} 
What will be the result of the code above?
Explanation
The == operator will compare for equality and the === operator compare for both equality and type. Example:

var a = false;
a == '0' // true;
a === '0' // false, because typeof(a) boolean and typeof('0') is a string.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback