Is there any performance improvement when using ===?
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 again for same reason, type is not same '0' == false // true because basically in logical operator fasle emans 0 '0' === false // false becasue type is different
From the above answer you can understand, The
== operator will compare for equality by doing any necessary type conversions(if required) while on the other hand
=== operator , will not do the conversion, so if two values are not the same type
=== will simply return
So you can say
In terms of performance, === is not quicker if the types are the same. If types are not the same, === will be quicker because it won't try to do the conversion