Strict inequality (!==)
BaselineWidely 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.
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: true
Syntax
x !== y
Description
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"; // true
Examples
Comparing operands of the same type
"hello" !== "hello"; // false"hello" !== "hola"; // true3 !== 3; // false3 !== 4; // truetrue !== true; // falsetrue !== false; // truenull !== null; // false
Comparing operands of different types
"3" !== 3; // truetrue !== 1; // truenull !== undefined; // true
Comparing objects
const object1 = { key: "value",};const object2 = { key: "value",};console.log(object1 !== object2); // trueconsole.log(object1 !== object1); // false
Specifications
Specification |
---|
ECMAScript® 2026 Language Specification # sec-equality-operators |