Strict inequality (!==)
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Thestrict inequality (!==) operator checks whether its two operands arenot equal, returning a Boolean result. Unlike theinequalityoperator, the strict inequality operator always considers operands of different types tobe different.
In this article
Try it
console.log(1 !== 1);// Expected output: falseconsole.log("hello" !== "hello");// Expected output: falseconsole.log("1" !== 1);// Expected output: trueconsole.log(0 !== false);// Expected output: trueSyntax
x !== yDescription
The strict inequality operator checks whether its operands are not equal.It is the negation of thestrict equality operatorso the following two lines will always give the same result:
x !== y;!(x === y);For details of the comparison algorithm, see the page for thestrict equality operator.
Like the strict equality operator, the strict inequality operator will always consideroperands of different types to be different:
3 !== "3"; // trueExamples
>Comparing operands of the same type
"hello" !== "hello"; // false"hello" !== "hola"; // true3 !== 3; // false3 !== 4; // truetrue !== true; // falsetrue !== false; // truenull !== null; // falseComparing operands of different types
"3" !== 3; // truetrue !== 1; // truenull !== undefined; // trueComparing objects
const object1 = { key: "value",};const object2 = { key: "value",};console.log(object1 !== object2); // trueconsole.log(object1 !== object1); // falseSpecifications
| Specification |
|---|
| ECMAScript® 2026 Language Specification> # sec-equality-operators> |