Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Difference between “ == “ and “ === “ operators.

/*
== in JavaScript is used for comparing two variables.
=== is used for comparing two variables, 
but this operator also checks datatype and compares two values
*/

0 == false   // true
0 === false  // false, because they are of a different type
1 == "1"     // true, automatic type conversion for value only
1 === "1"    // false, because they are of a different type
null == undefined // true
null === undefined // false
'0' == false // true
'0' === false // false
Source by www.interviewbit.com #
 
PREVIOUS NEXT
Tagged: #Difference
ADD COMMENT
Topic
Name
5+4 =