main difference between “==” and “===” operator is that formerly compares variable by making type correction e.g. if you compare a number with a string with numeric literal, == allows that, but === doesn’t allow that, because it not only checks the value but also type of two variable, if two variables are not of the same type “===” return false, while “==” return true.
Interviews2 answers
Difference between == and === in javascript?
2 Answers
Bidyasagar MishraPosted Aug 1, 2019, 9:45 PM EDT
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
1 === 1 // true, because they are strictly same type
null == undefined // true
null === undefined // false
'0' == false // true
'0' === false // false
kakku singhPosted Mar 16, 2017, 9:49 AM EDT
