== Operator
•“==‘’ operator is used to compare two values.
•It does not check the data type of operands while comparisons.
•Rather it performs the type Coercion while comparing.
=== operator (strict equality )
•“===‘’ operator is also used to compare two values.
•It checks not only the values but also types of two variables.
•It does perform the type Coercion while comparing.
Object.is()
•Object.is() overcomes the limitations of “===” operator.
•Object.is(NaN, NaN) is true;
•Object.is(0, -0) is false;
•Rest all behavior is similar to that of strict equality operator.
Please check below video to look into detailed explaination with examples in == vs === vs Object.is() in JavaScrtipt:
Please let me know in comment section of video, if you have any questions related to this topic.
Categories: Javascript