difference between === and == comparisons operators in JavaScript

The == operator will compare equality by ignoring variable type  The === operator compares variable type and value so if two values are not the same type === will simply return false. Both are equally quick.

Following are the examples of both operators 

== operator 

=== operator 

'' == '0'           // false
0 == ''             // true
0 == '0'            // true

false == 'false'    // false
false == '0'        // true

false == undefined  // false
false == null       // false
null == undefined   // true


 


Tags:

Share:

Related posts