diff options
author | Masahiro FUJIMOTO <mfujimot@gmail.com> | 2021-09-25 22:11:56 +0900 |
---|---|---|
committer | Masahiro FUJIMOTO <mfujimot@gmail.com> | 2021-10-08 02:02:05 +0900 |
commit | 94bc5410db5680cabc9261063e45bb92abfebd9d (patch) | |
tree | fc032f0a52050f94f7eba5119911f9c14b1fbc62 /files/ja/web/javascript | |
parent | 95bee9cfbeb4f714de4ee66a952e9bcd308978b9 (diff) | |
download | translated-content-94bc5410db5680cabc9261063e45bb92abfebd9d.tar.gz translated-content-94bc5410db5680cabc9261063e45bb92abfebd9d.tar.bz2 translated-content-94bc5410db5680cabc9261063e45bb92abfebd9d.zip |
Operators/Addition を更新
- 2021/07/21 時点の英語版に同期
Diffstat (limited to 'files/ja/web/javascript')
-rw-r--r-- | files/ja/web/javascript/reference/operators/addition/index.md | 84 |
1 files changed, 36 insertions, 48 deletions
diff --git a/files/ja/web/javascript/reference/operators/addition/index.md b/files/ja/web/javascript/reference/operators/addition/index.md index dc258fc3c1..fed9a4fa48 100644 --- a/files/ja/web/javascript/reference/operators/addition/index.md +++ b/files/ja/web/javascript/reference/operators/addition/index.md @@ -6,77 +6,65 @@ tags: - Language feature - Operator - Reference +browser-compat: javascript.operators.addition translation_of: Web/JavaScript/Reference/Operators/Addition --- -<div>{{jsSidebar("Operators")}}</div> +{{jsSidebar("Operators")}} -<p>加算演算子 (<code>+</code>) は、数値オペランドまたは文字列連結の合計を生成します。</p> +加算演算子 (`+`) は、数値オペランドの合計または文字列の連結を生成します。 -<div>{{EmbedInteractiveExample("pages/js/expressions-addition.html")}}</div> +{{EmbedInteractiveExample("pages/js/expressions-addition.html")}} -<div></div> +## 構文 +```js +x + y +``` +## 例 -<h2 id="構文">構文</h2> +### 数値の加算 -<pre class="syntaxbox notranslate"><strong>Operator:</strong> <var>x</var> + <var>y</var> -</pre> - -<h2 id="例">例</h2> - -<h3 id="数値加算">数値加算</h3> - -<pre class="brush: js notranslate">// 数値 + 数値 -> 加算 +```js +// 数値 + 数値 -> 加算 1 + 2 // 3 -// ブール値 + 数値 -> 加算 +// 論理値 + 数値 -> 加算 true + 1 // 2 -// ブール値 + ブール値 -> 加算 +// 論理値 + 論理値 -> 加算 false + false // 0 -</pre> +``` -<h3 id="文字列連結">文字列連結</h3> +### 文字列の連結 -<pre class="brush: js notranslate">// 文字列 + 文字列 -> 連結 +```js +// 文字列 + 文字列 -> 連結 'foo' + 'bar' // "foobar" -// 数値 + 文字列 -> 連結 +// 数値 + 文字列 -> 連結 5 + 'foo' // "5foo" -// 文字列 + ブール値 -> 連結 -'foo' + false // "foofalse"</pre> - -<h2 id="仕様">仕様</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">仕様</th> - </tr> - <tr> - <td>{{SpecName('ESDraft', '#sec-addition-operator-plus', 'Addition operator')}}</td> - </tr> - </tbody> -</table> +// 文字列 + 論理値 -> 連結 +'foo' + false // "foofalse" +``` -<h2 id="ブラウザーの互換性">ブラウザーの互換性</h2> +## 仕様書 +{{Specifications}} +## ブラウザーの互換性 -<p>{{Compat("javascript.operators.addition")}}</p> +{{Compat}} -<h2 id="関連項目">関連項目</h2> +## 関連情報 -<ul> - <li><a href="/ja/docs/Web/JavaScript/Reference/Operators/Subtraction">減算演算子</a></li> - <li><a href="/ja/docs/Web/JavaScript/Reference/Operators/Division">除算演算子</a></li> - <li><a href="/ja/docs/Web/JavaScript/Reference/Operators/Multiplication">乗算演算子</a></li> - <li><a href="/ja/docs/Web/JavaScript/Reference/Operators/Remainder">剰余演算子</a></li> - <li><a href="/ja/docs/Web/JavaScript/Reference/Operators/Exponentiation">べき乗演算子</a></li> - <li><a href="/ja/docs/Web/JavaScript/Reference/Operators/Increment">インクリメント演算子</a></li> - <li><a href="/ja/docs/Web/JavaScript/Reference/Operators/Decrement">デクリメント演算子</a></li> - <li><a href="/ja/docs/Web/JavaScript/Reference/Operators/Unary_negation">単項マイナス演算子</a></li> - <li><a href="/ja/docs/Web/JavaScript/Reference/Operators/Unary_plus">単項プラス演算子</a></li> -</ul> +- [減算演算子](/ja/docs/Web/JavaScript/Reference/Operators/Subtraction) +- [除算演算子](/ja/docs/Web/JavaScript/Reference/Operators/Division) +- [乗算演算子](/ja/docs/Web/JavaScript/Reference/Operators/Multiplication) +- [剰余演算子](/ja/docs/Web/JavaScript/Reference/Operators/Remainder) +- [べき乗演算子](/ja/docs/Web/JavaScript/Reference/Operators/Exponentiation) +- [インクリメント演算子](/ja/docs/Web/JavaScript/Reference/Operators/Increment) +- [デクリメント演算子](/ja/docs/Web/JavaScript/Reference/Operators/Decrement) +- [単項マイナス演算子](/ja/docs/Web/JavaScript/Reference/Operators/Unary_negation) +- [単項プラス演算子](/ja/docs/Web/JavaScript/Reference/Operators/Unary_plus) |