From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../operators/strict_inequality/index.html | 102 +++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 files/ja/web/javascript/reference/operators/strict_inequality/index.html (limited to 'files/ja/web/javascript/reference/operators/strict_inequality') diff --git a/files/ja/web/javascript/reference/operators/strict_inequality/index.html b/files/ja/web/javascript/reference/operators/strict_inequality/index.html new file mode 100644 index 0000000000..189e872104 --- /dev/null +++ b/files/ja/web/javascript/reference/operators/strict_inequality/index.html @@ -0,0 +1,102 @@ +--- +title: 厳密不等価 (!==) +slug: Web/JavaScript/Reference/Operators/Strict_inequality +tags: + - JavaScript + - Language feature + - Operator + - Reference + - 演算子 + - 言語機能 +translation_of: Web/JavaScript/Reference/Operators/Strict_inequality +--- +
{{jsSidebar("Operators")}}
+ +

厳密不等価演算子 (!==) は、二つのオペランドが等しくないことを検査し、論理値で結果を返します 不等価演算子とは異なり、厳密不等価演算子はオペランドの型が異なる場合、常に異なると判断します。

+ +
{{EmbedInteractiveExample("pages/js/expressions-strict-equality.html")}}
+ + + +

構文

+ +
x !== y
+ +

解説

+ +

厳密不等価演算子は、オペランドが等しくないことを検査します。これは厳密等価演算子の逆に当たるので、以下の2行は常に同じ結果を生み出します。

+ +
x !== y
+
+!(x === y)
+ +

比較アルゴリズムの詳細については、厳密等価演算子のページをご覧ください。

+ +

厳密等価演算子とと同様に、厳密不等価演算子はオペランドの型が異なると、常に異なるものと見なします。

+ +
3 !== "3"; // true
+ +

+ +

オペランドが同じ型である場合の比較

+ +
console.log("hello" !== "hello");   // false
+console.log("hello" !== "hola");    // true
+
+console.log(3 !== 3);               // false
+console.log(3 !== 4);               // true
+
+console.log(true !== true);         // false
+console.log(true !== false);        // true
+
+console.log(null !== null);         // false
+ +

オペランドが異なる方である場合の比較

+ +
console.log("3" !== 3);           // true
+
+console.log(true !== 1);          // true
+
+console.log(null !== undefined);  // true
+ +

オブジェクトの比較

+ +
const object1 = {
+  name: "hello"
+}
+
+const object2 = {
+  name: "hello"
+}
+
+console.log(object1 !== object2);  // true
+console.log(object1 !== object1);  // false
+ +

仕様書

+ + + + + + + + + + + + +
仕様書
{{SpecName('ESDraft', '#sec-equality-operators', 'Equality operators')}}
+ +

ブラウザーの互換性

+ + + +

{{Compat("javascript.operators.strict_inequality")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf