Why there is ( ===) operator?


Why they are telling us to use the (===) operator? even if we have (==) and both are working same.?


for which language? I assume JS. They do absolutely not work the same, and its generally advised to use triple equal sign unless you have a really good reason to use double equal sign.

== doesn’t check that the data type is also a match, so "0" == 0 is true while "0" === 0 is false. But it can be far worse:

if( [] == false ){

but it gets worse, because 0 == "0" is true, and 0 == [] is true, so then surely "0" == [] should also be true, and that is where you would be wrong, "0" == [] is false, this is why we use triple equal sign, to avoid this weird and confusing behavior.


JS doesn’t check, it coerces being as it is so bent on getting anything to work before it gives up.