diff options
author | Florian Merz <me@fiji-flo.de> | 2021-02-11 12:07:59 +0100 |
---|---|---|
committer | Florian Merz <me@fiji-flo.de> | 2021-02-11 12:07:59 +0100 |
commit | 6ef1fa4618e08426b874529619a66adbd3d1fcf0 (patch) | |
tree | 890e3e27131be010d82ef957fa68db495006cb0e /files/ja/web/javascript/guide/operators/arithmetic_operators | |
parent | 8260a606c143e6b55a467edf017a56bdcd6cba7e (diff) | |
download | translated-content-6ef1fa4618e08426b874529619a66adbd3d1fcf0.tar.gz translated-content-6ef1fa4618e08426b874529619a66adbd3d1fcf0.tar.bz2 translated-content-6ef1fa4618e08426b874529619a66adbd3d1fcf0.zip |
unslug ja: move
Diffstat (limited to 'files/ja/web/javascript/guide/operators/arithmetic_operators')
-rw-r--r-- | files/ja/web/javascript/guide/operators/arithmetic_operators/index.html | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/files/ja/web/javascript/guide/operators/arithmetic_operators/index.html b/files/ja/web/javascript/guide/operators/arithmetic_operators/index.html deleted file mode 100644 index 4aa9662292..0000000000 --- a/files/ja/web/javascript/guide/operators/arithmetic_operators/index.html +++ /dev/null @@ -1,47 +0,0 @@ ---- -title: 算術演算子 -slug: Web/JavaScript/Guide/Operators/Arithmetic_Operators ---- -<h3 id=".E7.AE.97.E8.A1.93.E6.BC.94.E7.AE.97.E5.AD.90" name=".E7.AE.97.E8.A1.93.E6.BC.94.E7.AE.97.E5.AD.90">算術演算子</h3> -<p>算術演算子は、そのオペランドに数値(リテラルか変数)をとり、1 つの数値を返します。標準的な算術演算子は、加算 (+)、減算 (-)、乗算 (*)、除算 (/) です。これらの演算子は他のほとんどのプログラミング言語と同じように機能しますが、そのときの数値は、浮動小数点数として扱われます(0 で除算した結果は、<a href="/ja/Core_JavaScript_1.5_Reference/Global_Properties/NaN" title="ja/Core_JavaScript_1.5_Reference/Global_Properties/NaN"><code>NaN</code></a> になることにも注意してください)。</p> -<pre>1 / 2 // JavaScript では 0.5 を返す -1 / 2 // Java では 0 を返す(どちらの数も浮動小数点数として明記されていない) - -1.0 / 2.0 // JavaScript でも Java でも 0.5 を返す -</pre> -<p>さらに、JavaScript では以下の表で示された算術演算子も使用できます。</p> -<table class="fullwidth-table"> - <tbody> - <tr> - <th>演算子</th> - <th>説明</th> - <th>例</th> - </tr> - <tr> - <td>%<br> - (モジュロ)</td> - <td>2 項演算子。2 つのオペランドで除算したときの整数の余りを返す。</td> - <td>12 % 5 は 2 を返す。</td> - </tr> - <tr> - <td>++<br> - (インクリメント)</td> - <td>単項演算子。オペランドに 1 を加える。前置演算子 (++x) を使った場合、オペランドに 1 を加えた後にその値を返す。後置演算子 (x++) を使った場合、オペランドに 1 を加える前にその値を返す。</td> - <td><code>x</code> が 3 のとき、<code>++x</code> は <code>x</code> に 4 をセットし、4 を返す。一方、<code>x++</code> は <code>x</code> に 4 をセットし、3 を返す。</td> - </tr> - <tr> - <td>--<br> - (デクリメント)</td> - <td>単項演算子。オペランドから 1 を引く。戻り値はインクリメント演算子のものと同様。</td> - <td><code>x</code> が 3 のとき、<code>--x</code> は <code>x</code> に 2 をセットし、2 を返す。一方、<code>x--</code> は <code>x</code> に 2 をセットし、3 を返す。</td> - </tr> - <tr> - <td>-<br> - (符号反転)</td> - <td>単項演算子。オペランドの符号を反転してその値を返す。</td> - <td><code>x</code> が 3 のとき、<code>-x</code> は -3 を返す。</td> - </tr> - </tbody> -</table> -<p><small><strong>表 3.4:算術演算子</strong></small></p> -<p>{{ PreviousNext("JavaScript/Guide/Operators/Comparison_Operators", "JavaScript/Guide/Operators/Bitwise_Operators") }}</p> |