diff options
Diffstat (limited to 'files/ja/web/javascript/reference/operators/greater_than')
-rw-r--r-- | files/ja/web/javascript/reference/operators/greater_than/index.md | 124 |
1 files changed, 61 insertions, 63 deletions
diff --git a/files/ja/web/javascript/reference/operators/greater_than/index.md b/files/ja/web/javascript/reference/operators/greater_than/index.md index e5a05c3bbb..c6da0b0667 100644 --- a/files/ja/web/javascript/reference/operators/greater_than/index.md +++ b/files/ja/web/javascript/reference/operators/greater_than/index.md @@ -3,98 +3,96 @@ title: 大なり (>) slug: Web/JavaScript/Reference/Operators/Greater_than tags: - JavaScript - - Language feature - - Operator + - 言語機能 + - 演算子 - Reference +browser-compat: javascript.operators.greater_than translation_of: Web/JavaScript/Reference/Operators/Greater_than --- -<div>{{jsSidebar("Operators")}}</div> +{{jsSidebar("Operators")}} -<p>大なり演算子 (<code>></code>) は、左辺のオペランドが右辺のオペランドより大きい場合は <code>true</code> を返し、それ以外の場合は <code>false</code> を返します。</p> +大なり演算子 (`>`) は、左辺のオペランドが右辺のオペランドより大きい場合は `true` を返し、それ以外の場合は `false` を返します。 -<div>{{EmbedInteractiveExample("pages/js/expressions-greater-than.html")}}</div> +{{EmbedInteractiveExample("pages/js/expressions-greater-than.html")}} +## 構文 +```js +x > y +``` -<h2 id="構文">構文</h2> +## 解説 -<pre class="syntaxbox notranslate">x > y</pre> +オペランドは、[抽象関係比較](https://tc39.es/ecma262/#sec-abstract-relational-comparison)アルゴリズムを使用して比較されます。このアルゴリズムの概要については、[小なり](/ja/docs/Web/JavaScript/Reference/Operators/Less_than)演算子のドキュメントを参照して下さい。 -<h2 id="解説">解説</h2> +## 例 -<p>オペランドは、 <a class="external external-icon" href="https://tc39.es/ecma262/#sec-abstract-relational-comparison" rel="noopener">抽象関係比較</a> アルゴリズムを使用して比較されます。このアルゴリズムの概要については、 <a href="/ja/docs/Web/JavaScript/Reference/Operators/Less_than">小なり</a> 演算子のドキュメントを参照して下さい。</p> +### 文字列と文字列の比較 -<h2 id="例">例</h2> +```js +console.log("a" > "b"); // false +console.log("a" > "a"); // false +console.log("a" > "3"); // true +``` -<h3 id="文字列と文字列の比較">文字列と文字列の比較</h3> +### 文字列と数値の比較 -<pre class="brush: js notranslate">console.log("a" > "b"); // false -console.log("a" > "a"); // false -console.log("a" > "3"); // true</pre> +```js +console.log("5" > 3); // true +console.log("3" > 3); // false +console.log("3" > 5); // false -<h3 id="文字列と数値の比較">文字列と数値の比較</h3> +console.log("hello" > 5); // false +console.log(5 > "hello"); // false -<pre class="brush: js notranslate">console.log("5" > 3); // true -console.log("3" > 3); // false -console.log("3" > 5); // false +console.log("5" > 3n); // true +console.log("3" > 5n); // false +``` -console.log("hello" > 5); // false -console.log(5 > "hello"); // false +### 数値と数値の比較 -console.log("5" > 3n); // true -console.log("3" > 5n); // false</pre> +```js +console.log(5 > 3); // true +console.log(3 > 3); // false +console.log(3 > 5); // false +``` -<h3 id="数値と数値の比較">数値と数値の比較</h3> +### Number と BigInt の比較 -<pre class="brush: js notranslate">console.log(5 > 3); // true -console.log(3 > 3); // false -console.log(3 > 5); // false</pre> +```js +console.log(5n > 3); // true +console.log(3 > 5n); // false +``` -<h3 id="数値と_BigInt_の比較">数値と BigInt の比較</h3> +### 論理値、null、undefined、NaN の比較 -<pre class="brush: js notranslate">console.log(5n > 3); // true -console.log(3 > 5n); // false</pre> +```js +console.log(true > false); // true +console.log(false > true); // false -<h3 id="ブール値、_null_、_undefined_、_NaN_の比較">ブール値、 null 、 undefined 、 NaN の比較</h3> +console.log(true > 0); // true +console.log(true > 1); // false -<pre class="brush: js notranslate">console.log(true > false); // true -console.log(false > true); // false +console.log(null > 0); // false +console.log(1 > null); // true -console.log(true > 0); // true -console.log(true > 1); // false +console.log(undefined > 3); // false +console.log(3 > undefined); // false -console.log(null > 0); // false -console.log(1 > null); // true +console.log(3 > NaN); // false +console.log(NaN > 3); // false +``` -console.log(undefined > 3); // false -console.log(3 > undefined); // false +## 仕様書 -console.log(3 > NaN); // false -console.log(NaN > 3); // false</pre> +{{Specifications}} -<h2 id="仕様">仕様</h2> +## ブラウザーの互換性 -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">仕様</th> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-relational-operators', 'Relational operators')}}</td> - </tr> - </tbody> -</table> +{{Compat}} -<h2 id="ブラウザーの互換性">ブラウザーの互換性</h2> +## 関連情報 - - -<p>{{Compat("javascript.operators.greater_than")}}</p> - -<h2 id="関連項目">関連項目</h2> - -<ul> - <li><a href="/ja/docs/Web/JavaScript/Reference/Operators/Greater_than_or_equal">Greater than or equal operator</a></li> - <li><a href="/ja/docs/Web/JavaScript/Reference/Operators/Less_than">Less than operator</a></li> - <li><a href="/ja/docs/Web/JavaScript/Reference/Operators/Less_than_or_equal">Less than or equal operator</a></li> -</ul> +- [大なりイコール演算子](/ja/docs/Web/JavaScript/Reference/Operators/Greater_than_or_equal) +- [小なり演算子](/ja/docs/Web/JavaScript/Reference/Operators/Less_than) +- [小なりイコール演算子](/ja/docs/Web/JavaScript/Reference/Operators/Less_than_or_equal) |