Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

Strict inequality operator (!==)

The !== operator checks whether two values are not strictly equal, without type conversion. It returns a Boolean; when comparing objects, identity matters rather than contents.

Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support

Syntax

left !== right

left !== right returns the negation of left === right: true when the values are not strictly equal, and false otherwise. It is a comparison, not an assignment. “Strict” does not require enabling strict mode.

Different types always produce true, so 5 !== "5" is true. Unlike !=, the !== operator does not convert its operands to a common type. For example, null !== undefined produces true, whereas null != undefined produces false.

Objects, including arrays and functions, are compared by identity, not contents. Two references to the same object produce false; two distinct objects produce true, even if their properties are identical. Do not use !== to compare object structure.

Important numeric cases: NaN !== NaN produces true, while +0 !== -0 produces false. The example demonstrates these cases and the difference between a shared reference and a separate object.

Examples

const item = { id: 1 };
const alias = item;

console.log(5 !== "5");
console.log(5 !== 5);
console.log(item !== alias);
console.log(item !== { id: 1 });
console.log(NaN !== NaN);
console.log(+0 !== -0);

Result

true
false
false
true
true
false

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources