From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../reference/operators/remainder/index.html | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 files/ja/web/javascript/reference/operators/remainder/index.html (limited to 'files/ja/web/javascript/reference/operators/remainder') diff --git a/files/ja/web/javascript/reference/operators/remainder/index.html b/files/ja/web/javascript/reference/operators/remainder/index.html new file mode 100644 index 0000000000..7bc17ee93d --- /dev/null +++ b/files/ja/web/javascript/reference/operators/remainder/index.html @@ -0,0 +1,78 @@ +--- +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")}}
+ +
+ + + +

構文

+ +
Operator: 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
+ +

仕様

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

ブラウザーの互換性

+ + + +

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

+ +

関連項目

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