CKTIS / JavaScript
===: strict equality
The === operator compares values without converting different types to make them match. It returns a boolean: true or false.
Version: ECMAScript 2020+
Syntax
left === rightDifferent types produce false: 2 === "2" is false. Strings must contain the same sequence of code units; the operator neither ignores case nor performs Unicode normalization. Boolean values are compared by their logical value.
For numbers, NaN === NaN is false, while 0 === -0 is true. Use Number.isNaN to check for NaN. Object.is has different rules for NaN and signed zeros; it is not a mechanical replacement for every comparison.
Objects and arrays are compared by identity. Two separately created [1] arrays are not strictly equal even though they contain the same number. Two variables referring to the same array are equal. Structural comparison needs a separate rule suited to the data.
!== negates strict equality. Do not confuse either operator with assignment using =, or with ==, which applies additional conversion rules.
Examples
const first = [1];
const same = first;
console.log(2 === "2");
console.log(first === same, first === [1]);
console.log(NaN === NaN, 0 === -0);
console.log(Number.isNaN(NaN));Result
false true false false true true