Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

Strict inequality (!==)

BaselineWidely available

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

js
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:

js
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:

js
3 !== "3"; // true

Examples

Comparing operands of the same type

js
"hello" !== "hello"; // false"hello" !== "hola"; // true3 !== 3; // false3 !== 4; // truetrue !== true; // falsetrue !== false; // truenull !== null; // false

Comparing operands of different types

js
"3" !== 3; // truetrue !== 1; // truenull !== undefined; // true

Comparing objects

js
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

Browser compatibility

See also

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp