From 722252a0dd72f67d8b704e9e869ea9b0cbffde65 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Sat, 25 Sep 2021 22:16:30 +0900 Subject: Markdown化のためのファイル名変更 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reference/operators/division/index.html | 76 --------------- .../reference/operators/division/index.md | 76 +++++++++++++++ .../reference/operators/exponentiation/index.html | 103 --------------------- .../reference/operators/exponentiation/index.md | 103 +++++++++++++++++++++ .../reference/operators/multiplication/index.html | 74 --------------- .../reference/operators/multiplication/index.md | 74 +++++++++++++++ .../reference/operators/remainder/index.html | 82 ---------------- .../reference/operators/remainder/index.md | 82 ++++++++++++++++ .../reference/operators/subtraction/index.html | 68 -------------- .../reference/operators/subtraction/index.md | 68 ++++++++++++++ 10 files changed, 403 insertions(+), 403 deletions(-) delete mode 100644 files/ja/web/javascript/reference/operators/division/index.html create mode 100644 files/ja/web/javascript/reference/operators/division/index.md delete mode 100644 files/ja/web/javascript/reference/operators/exponentiation/index.html create mode 100644 files/ja/web/javascript/reference/operators/exponentiation/index.md delete mode 100644 files/ja/web/javascript/reference/operators/multiplication/index.html create mode 100644 files/ja/web/javascript/reference/operators/multiplication/index.md delete mode 100644 files/ja/web/javascript/reference/operators/remainder/index.html create mode 100644 files/ja/web/javascript/reference/operators/remainder/index.md delete mode 100644 files/ja/web/javascript/reference/operators/subtraction/index.html create mode 100644 files/ja/web/javascript/reference/operators/subtraction/index.md (limited to 'files/ja/web/javascript') diff --git a/files/ja/web/javascript/reference/operators/division/index.html b/files/ja/web/javascript/reference/operators/division/index.html deleted file mode 100644 index 3db6a5715d..0000000000 --- a/files/ja/web/javascript/reference/operators/division/index.html +++ /dev/null @@ -1,76 +0,0 @@ ---- -title: 除算 (/) -slug: Web/JavaScript/Reference/Operators/Division -tags: - - JavaScript - - Language feature - - Operator - - Reference -translation_of: Web/JavaScript/Reference/Operators/Division ---- -
{{jsSidebar("Operators")}}
- -

除算演算子 (/) は、左のオペランドを被除数とし右のオペランドを除数としたオペランド同士の商を生成します。

- -
{{EmbedInteractiveExample("pages/js/expressions-division.html")}}
- -
- - - -

構文

- -
Operator: x / y
-
- -

- -

基本の除算

- -
1 / 2              // 0.5
-
-Math.floor(3 / 2) // 1
-
-1.0 / 2.0         // 0.5
-
- -

ゼロ除算

- -
2.0 / 0     // Infinity
-
-2.0 / 0.0   // Infinity, because 0.0 === 0
-
-2.0 / -0.0  // -Infinity
- -

仕様

- - - - - - - - - - -
仕様
{{SpecName('ESDraft', '#sec-multiplicative-operators', 'Division operator')}}
- -

ブラウザーの互換性

- - - -

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

- -

関連項目

- - diff --git a/files/ja/web/javascript/reference/operators/division/index.md b/files/ja/web/javascript/reference/operators/division/index.md new file mode 100644 index 0000000000..3db6a5715d --- /dev/null +++ b/files/ja/web/javascript/reference/operators/division/index.md @@ -0,0 +1,76 @@ +--- +title: 除算 (/) +slug: Web/JavaScript/Reference/Operators/Division +tags: + - JavaScript + - Language feature + - Operator + - Reference +translation_of: Web/JavaScript/Reference/Operators/Division +--- +
{{jsSidebar("Operators")}}
+ +

除算演算子 (/) は、左のオペランドを被除数とし右のオペランドを除数としたオペランド同士の商を生成します。

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

構文

+ +
Operator: x / y
+
+ +

+ +

基本の除算

+ +
1 / 2              // 0.5
+
+Math.floor(3 / 2) // 1
+
+1.0 / 2.0         // 0.5
+
+ +

ゼロ除算

+ +
2.0 / 0     // Infinity
+
+2.0 / 0.0   // Infinity, because 0.0 === 0
+
+2.0 / -0.0  // -Infinity
+ +

仕様

+ + + + + + + + + + +
仕様
{{SpecName('ESDraft', '#sec-multiplicative-operators', 'Division operator')}}
+ +

ブラウザーの互換性

+ + + +

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

+ +

関連項目

+ + diff --git a/files/ja/web/javascript/reference/operators/exponentiation/index.html b/files/ja/web/javascript/reference/operators/exponentiation/index.html deleted file mode 100644 index 40531f5a6c..0000000000 --- a/files/ja/web/javascript/reference/operators/exponentiation/index.html +++ /dev/null @@ -1,103 +0,0 @@ ---- -title: べき乗 (**) -slug: Web/JavaScript/Reference/Operators/Exponentiation -tags: - - JavaScript - - Language feature - - Operator - - Reference -translation_of: Web/JavaScript/Reference/Operators/Exponentiation ---- -
{{jsSidebar("Operators")}}
- -

べき乗演算子 (**) は、1番目のオペランドを2番目のオペランドの累乗まで上げた結果を返します。これは Math.pow と同等ですが、オペランドとして BigInt も受け入れます。

- -
{{EmbedInteractiveExample("pages/js/expressions-exponentiation.html")}}
- - - -

構文

- -
Operator: var1 ** var2
-
- -

説明

- -

べき乗演算子は右結合的です: a ** b ** ca ** (b ** c) と等しくなります。

- -

PHP や Python など、べき乗演算子 (**) を持つほとんどの言語では、べき乗演算子は単項演算子 (単項演算子 + や単項演算子 - など) よりも優先順位が高いと定義されていますが、いくつかの例外があります。例えば、Bash では ** 演算子は単項演算子よりも優先順位が低いと定義されています。

- -

JavaScriptでは、あいまいなべき乗式を記述することはできません。 つまり、基数の直前に単項演算子 (+/-/~/!/delete/void/typeof) を置くことはできません。 これを行うと、SyntaxError が発生します。

- -
-2 ** 2;
-// Bashでは 4 他の言語では -4
-// JavaScriptでは意図があいまいなため無効
-
-
--(2 ** 2);
-// JavaScriptでは意図が明白なため -4
-
- -

注意: 一部のプログラミング言語ではべき乗計算にキャレット記号 ^ を使用していますが、JavaScript ではビット排他的論理和にこの記号を使用しています。

- -

- -

基本的なべき乗

- -
2 ** 3   // 8
-3 ** 2   // 9
-3 ** 2.5 // 15.588457268119896
-10 ** -1 // 0.1
-NaN ** 2 // NaN
-
- -

結合

- -
2 ** 3 ** 2   // 512
-2 ** (3 ** 2) // 512
-(2 ** 3) ** 2 // 64
- -

単項演算子との使用

- -

べき乗式の結果の符号を反転させる

- -
-(2 ** 2) // -4
-
- -

べき乗式の基底を強制的に負の数にする

- -
(-2) ** 2 // 4
-
- -

仕様

- - - - - - - - - - -
仕様書
{{SpecName('ESDraft', '#sec-exp-operator', 'Exponentiation operator')}}
- -

ブラウザの互換性

- - - -

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

- -

関連情報

- - diff --git a/files/ja/web/javascript/reference/operators/exponentiation/index.md b/files/ja/web/javascript/reference/operators/exponentiation/index.md new file mode 100644 index 0000000000..40531f5a6c --- /dev/null +++ b/files/ja/web/javascript/reference/operators/exponentiation/index.md @@ -0,0 +1,103 @@ +--- +title: べき乗 (**) +slug: Web/JavaScript/Reference/Operators/Exponentiation +tags: + - JavaScript + - Language feature + - Operator + - Reference +translation_of: Web/JavaScript/Reference/Operators/Exponentiation +--- +
{{jsSidebar("Operators")}}
+ +

べき乗演算子 (**) は、1番目のオペランドを2番目のオペランドの累乗まで上げた結果を返します。これは Math.pow と同等ですが、オペランドとして BigInt も受け入れます。

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

構文

+ +
Operator: var1 ** var2
+
+ +

説明

+ +

べき乗演算子は右結合的です: a ** b ** ca ** (b ** c) と等しくなります。

+ +

PHP や Python など、べき乗演算子 (**) を持つほとんどの言語では、べき乗演算子は単項演算子 (単項演算子 + や単項演算子 - など) よりも優先順位が高いと定義されていますが、いくつかの例外があります。例えば、Bash では ** 演算子は単項演算子よりも優先順位が低いと定義されています。

+ +

JavaScriptでは、あいまいなべき乗式を記述することはできません。 つまり、基数の直前に単項演算子 (+/-/~/!/delete/void/typeof) を置くことはできません。 これを行うと、SyntaxError が発生します。

+ +
-2 ** 2;
+// Bashでは 4 他の言語では -4
+// JavaScriptでは意図があいまいなため無効
+
+
+-(2 ** 2);
+// JavaScriptでは意図が明白なため -4
+
+ +

注意: 一部のプログラミング言語ではべき乗計算にキャレット記号 ^ を使用していますが、JavaScript ではビット排他的論理和にこの記号を使用しています。

+ +

+ +

基本的なべき乗

+ +
2 ** 3   // 8
+3 ** 2   // 9
+3 ** 2.5 // 15.588457268119896
+10 ** -1 // 0.1
+NaN ** 2 // NaN
+
+ +

結合

+ +
2 ** 3 ** 2   // 512
+2 ** (3 ** 2) // 512
+(2 ** 3) ** 2 // 64
+ +

単項演算子との使用

+ +

べき乗式の結果の符号を反転させる

+ +
-(2 ** 2) // -4
+
+ +

べき乗式の基底を強制的に負の数にする

+ +
(-2) ** 2 // 4
+
+ +

仕様

+ + + + + + + + + + +
仕様書
{{SpecName('ESDraft', '#sec-exp-operator', 'Exponentiation operator')}}
+ +

ブラウザの互換性

+ + + +

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

+ +

関連情報

+ + diff --git a/files/ja/web/javascript/reference/operators/multiplication/index.html b/files/ja/web/javascript/reference/operators/multiplication/index.html deleted file mode 100644 index 4aed5ac7f6..0000000000 --- a/files/ja/web/javascript/reference/operators/multiplication/index.html +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: 乗算 (*) -slug: Web/JavaScript/Reference/Operators/Multiplication -tags: - - JavaScript - - Language feature - - Operator - - Reference -translation_of: Web/JavaScript/Reference/Operators/Multiplication ---- -
{{jsSidebar("Operators")}}
- -

乗算演算子 (*) はオペランドの積を生成します。

- -
{{EmbedInteractiveExample("pages/js/expressions-multiplication.html")}}
- -
- - - -

構文

- -
Operator: x * y
-
- -

- -

数値を使用した乗算

- -
 2 * 2      // 4
--2 * 2     // -4
-
- -

無限大との乗算

- -
Infinity * 0         // NaN
-Infinity * Infinity  // Infinity
- -

非数との乗算

- -
'foo' * 2 // NaN
- -

仕様

- - - - - - - - - - -
仕様
{{SpecName('ESDraft', '#sec-multiplicative-operators', 'Multiplication operator')}}
- -

ブラウザーの互換性

- - - -

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

- -

関連項目

- - diff --git a/files/ja/web/javascript/reference/operators/multiplication/index.md b/files/ja/web/javascript/reference/operators/multiplication/index.md new file mode 100644 index 0000000000..4aed5ac7f6 --- /dev/null +++ b/files/ja/web/javascript/reference/operators/multiplication/index.md @@ -0,0 +1,74 @@ +--- +title: 乗算 (*) +slug: Web/JavaScript/Reference/Operators/Multiplication +tags: + - JavaScript + - Language feature + - Operator + - Reference +translation_of: Web/JavaScript/Reference/Operators/Multiplication +--- +
{{jsSidebar("Operators")}}
+ +

乗算演算子 (*) はオペランドの積を生成します。

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

構文

+ +
Operator: x * y
+
+ +

+ +

数値を使用した乗算

+ +
 2 * 2      // 4
+-2 * 2     // -4
+
+ +

無限大との乗算

+ +
Infinity * 0         // NaN
+Infinity * Infinity  // Infinity
+ +

非数との乗算

+ +
'foo' * 2 // NaN
+ +

仕様

+ + + + + + + + + + +
仕様
{{SpecName('ESDraft', '#sec-multiplicative-operators', 'Multiplication operator')}}
+ +

ブラウザーの互換性

+ + + +

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

+ +

関連項目

+ + diff --git a/files/ja/web/javascript/reference/operators/remainder/index.html b/files/ja/web/javascript/reference/operators/remainder/index.html deleted file mode 100644 index 0d757f4d3c..0000000000 --- a/files/ja/web/javascript/reference/operators/remainder/index.html +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: 剰余 (%) -slug: Web/JavaScript/Reference/Operators/Remainder -tags: -- JavaScript -- Language feature -- Operator -- Reference -translation_of: Web/JavaScript/Reference/Operators/Remainder ---- -
{{jsSidebar("Operators")}}
- -

剰余演算子 (%) は、 1 つ目のオペランドが 2 つ目のオペランドで除算されたときに残った剰余を返します。これは常に被除数の符号を取ります。

- -
{{EmbedInteractiveExample("pages/js/expressions-remainder.html")}}
- -

なお、多くの言語では ‘%’ はリマインダー演算子ですが、言語によっては (例えば Python や Perl では) モジュロ演算子になります。正の数同士の場合は、この 2 つの値は等価ですが、被除数と除数が異なる符号の場合は結果が異なります。 JavaScript でモジュロを得るには、 a % n の代わりに ((a % n ) + n ) % n を使用してください。

- -

構文

- -
演算子: var1 % var2
-
- -

- -

正の値の剰余

- -
 12 % 5  //  2
- 1 % -2 //  1
- 1 % 2  //  1
- 2 % 3  //  2
-5.5 % 2 // 1.5
-
- -

負の値の剰余

- -
-12 % 5 // -2
--1 % 2  // -1
--4 % 2  // -0
- -

NaN の剰余

- -
NaN % 2 // NaN
- -

無限大の剰余

- -
Infinity % 2 // NaN
-Infinity % 0 // NaN
-Infinity % Infinity // NaN
-
- -

仕様書

- - - - - - - - - - -
仕様書
{{SpecName('ESDraft', '#sec-multiplicative-operators', 'Remainder operator')}} -
- -

ブラウザーの互換性

- -

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

- -

関連項目

- - diff --git a/files/ja/web/javascript/reference/operators/remainder/index.md b/files/ja/web/javascript/reference/operators/remainder/index.md new file mode 100644 index 0000000000..0d757f4d3c --- /dev/null +++ b/files/ja/web/javascript/reference/operators/remainder/index.md @@ -0,0 +1,82 @@ +--- +title: 剰余 (%) +slug: Web/JavaScript/Reference/Operators/Remainder +tags: +- JavaScript +- Language feature +- Operator +- Reference +translation_of: Web/JavaScript/Reference/Operators/Remainder +--- +
{{jsSidebar("Operators")}}
+ +

剰余演算子 (%) は、 1 つ目のオペランドが 2 つ目のオペランドで除算されたときに残った剰余を返します。これは常に被除数の符号を取ります。

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

なお、多くの言語では ‘%’ はリマインダー演算子ですが、言語によっては (例えば Python や Perl では) モジュロ演算子になります。正の数同士の場合は、この 2 つの値は等価ですが、被除数と除数が異なる符号の場合は結果が異なります。 JavaScript でモジュロを得るには、 a % n の代わりに ((a % n ) + n ) % n を使用してください。

+ +

構文

+ +
演算子: var1 % var2
+
+ +

+ +

正の値の剰余

+ +
 12 % 5  //  2
+ 1 % -2 //  1
+ 1 % 2  //  1
+ 2 % 3  //  2
+5.5 % 2 // 1.5
+
+ +

負の値の剰余

+ +
-12 % 5 // -2
+-1 % 2  // -1
+-4 % 2  // -0
+ +

NaN の剰余

+ +
NaN % 2 // NaN
+ +

無限大の剰余

+ +
Infinity % 2 // NaN
+Infinity % 0 // NaN
+Infinity % Infinity // NaN
+
+ +

仕様書

+ + + + + + + + + + +
仕様書
{{SpecName('ESDraft', '#sec-multiplicative-operators', 'Remainder operator')}} +
+ +

ブラウザーの互換性

+ +

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

+ +

関連項目

+ + diff --git a/files/ja/web/javascript/reference/operators/subtraction/index.html b/files/ja/web/javascript/reference/operators/subtraction/index.html deleted file mode 100644 index 1a02506128..0000000000 --- a/files/ja/web/javascript/reference/operators/subtraction/index.html +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: 減算 (-) -slug: Web/JavaScript/Reference/Operators/Subtraction -tags: - - JavaScript - - Language feature - - Operator - - Reference -translation_of: Web/JavaScript/Reference/Operators/Subtraction ---- -
{{jsSidebar("Operators")}}
- -

減算演算子 (-) は2つのオペランドを減算し、それらの差を生成します。

- -
{{EmbedInteractiveExample("pages/js/expressions-subtraction.html")}}
- -
- - - -

構文

- -
Operator: x - y
-
- -

- -

数値による減算

- -
5 - 3     // 2
-3 - 5     // -2
- -

非数による減算

- -
'foo' - 3 // NaN
- -

仕様

- - - - - - - - - - -
仕様
{{SpecName('ESDraft', '#sec-subtraction-operator-minus', 'Subtraction operator')}}
- -

ブラウザーの互換性

- - - -

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

- -

関連項目

- - diff --git a/files/ja/web/javascript/reference/operators/subtraction/index.md b/files/ja/web/javascript/reference/operators/subtraction/index.md new file mode 100644 index 0000000000..1a02506128 --- /dev/null +++ b/files/ja/web/javascript/reference/operators/subtraction/index.md @@ -0,0 +1,68 @@ +--- +title: 減算 (-) +slug: Web/JavaScript/Reference/Operators/Subtraction +tags: + - JavaScript + - Language feature + - Operator + - Reference +translation_of: Web/JavaScript/Reference/Operators/Subtraction +--- +
{{jsSidebar("Operators")}}
+ +

減算演算子 (-) は2つのオペランドを減算し、それらの差を生成します。

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

構文

+ +
Operator: x - y
+
+ +

+ +

数値による減算

+ +
5 - 3     // 2
+3 - 5     // -2
+ +

非数による減算

+ +
'foo' - 3 // NaN
+ +

仕様

+ + + + + + + + + + +
仕様
{{SpecName('ESDraft', '#sec-subtraction-operator-minus', 'Subtraction operator')}}
+ +

ブラウザーの互換性

+ + + +

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

+ +

関連項目

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