blob: 8641cd8dab15da05e1c78c395f026d8319e5b24a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
---
title: べき乗代入 (**=)
slug: Web/JavaScript/Reference/Operators/Exponentiation_assignment
tags:
- 代入演算子
- JavaScript
- 言語機能
- 演算子
- Reference
translation_of: Web/JavaScript/Reference/Operators/Exponentiation_assignment
---
{{jsSidebar("Operators")}}
べき乗代入演算子 (`**=`) は、変数の値を右辺のオペランドでべき乗します。
{{EmbedInteractiveExample("pages/js/expressions-exponentiation-assignment.html")}}
<div></div>
## 構文
<pre class="syntaxbox notranslate"><strong>Operator:</strong> x **= y
<strong>Meaning:</strong> x = x ** y</pre>
## 例
<h3 id="べき乗代入の仕様">べき乗代入の仕様</h3>
<pre class="brush: js notranslate">// 次の変数を想定
// bar = 5
bar **= 2 // 25
bar **= 'foo' // NaN</pre>
<h2 id="仕様">仕様</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">仕様</th>
</tr>
<tr>
<td>{{SpecName('ESDraft', '#sec-assignment-operators', 'Assignment operators')}}</td>
</tr>
</tbody>
</table>
<h2 id="ブラウザー実装状況">ブラウザー実装状況</h2>
{{Compat("javascript.operators.exponentiation_assignment")}}
<h2 id="関連項目">関連項目</h2>
<ul>
<li><a href="/ja/docs/Web/JavaScript/Guide/Expressions_and_Operators#Assignment">Assignment operators in the JS guide</a></li>
<li><a href="/ja/docs/Web/JavaScript/Reference/Operators/Exponentiation">Exponentiation operator</a></li>
</ul>
|