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/addition/index.html | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 files/ja/web/javascript/reference/operators/addition/index.html (limited to 'files/ja/web/javascript/reference/operators/addition/index.html') diff --git a/files/ja/web/javascript/reference/operators/addition/index.html b/files/ja/web/javascript/reference/operators/addition/index.html new file mode 100644 index 0000000000..d87d6a2894 --- /dev/null +++ b/files/ja/web/javascript/reference/operators/addition/index.html @@ -0,0 +1,82 @@ +--- +title: 加算 (+) +slug: Web/JavaScript/Reference/Operators/Addition +tags: + - JavaScript + - Language feature + - Operator + - Reference +translation_of: Web/JavaScript/Reference/Operators/Addition +--- +
{{jsSidebar("Operators")}}
+ +

加算演算子 (+) は、数値オペランドまたは文字列連結の合計を生成します。

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

構文

+ +
Operator: x + y
+
+ +

+ +

数値加算

+ +
// 数値 + 数値 -> 加算
+1 + 2 // 3
+
+// ブール値 + 数値 -> 加算
+true + 1 // 2
+
+// ブール値 + ブール値 -> 加算
+false + false // 0
+
+ +

文字列連結

+ +
// 文字列 + 文字列 -> 連結
+'foo' + 'bar' // "foobar"
+
+// 数値 + 文字列 -> 連結
+5 + 'foo' // "5foo"
+
+// 文字列 + ブール値 -> 連結
+'foo' + false // "foofalse"
+ +

仕様

+ + + + + + + + + + +
仕様
{{SpecName('ESDraft', '#sec-addition-operator-plus', 'Addition operator')}}
+ +

ブラウザーの互換性

+ + + +

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

+ +

関連項目

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