From 1a9dcfb7fcefa92627be0033f0edaf609c5444bf Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Mon, 27 Sep 2021 22:07:28 +0900 Subject: JavaScript の等価演算子を変換準備 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operators/strict_inequality/index.html | 100 --------------------- .../reference/operators/strict_inequality/index.md | 100 +++++++++++++++++++++ 2 files changed, 100 insertions(+), 100 deletions(-) delete mode 100644 files/ja/web/javascript/reference/operators/strict_inequality/index.html create mode 100644 files/ja/web/javascript/reference/operators/strict_inequality/index.md (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 deleted file mode 100644 index c74ae24677..0000000000 --- a/files/ja/web/javascript/reference/operators/strict_inequality/index.html +++ /dev/null @@ -1,100 +0,0 @@ ---- -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")}}

- -

関連情報

- - diff --git a/files/ja/web/javascript/reference/operators/strict_inequality/index.md b/files/ja/web/javascript/reference/operators/strict_inequality/index.md new file mode 100644 index 0000000000..c74ae24677 --- /dev/null +++ b/files/ja/web/javascript/reference/operators/strict_inequality/index.md @@ -0,0 +1,100 @@ +--- +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