[100] == 100 // true
[100] === 100 // false
'100' == 100 // true
'100' === 100 // false
[] == 0 // true
[] === 0 // false
'' == false // true
'' === false // false
'' == 0 // true
'' === 0 // false
false == 0 // true
false === 0 // false
null == undefined // true
null === undefined // false
18 === 18 // true
18 === 19 // false
`18` == 18 // true
`18` === 18 // false
// == : loose equality operator (date type IS NOT relevant)
// === : strict equality operator (date type IS relevant)
// Note: the same applies for not equal
`18` != 18 // false
`18` !== 18 // true
function testEqual(val) {
if (val==12) { // If this condition is true
return "Equal";//This line is executed
}
return "Not Equal";//Or This line is executed
}
testEqual(10);