0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Exponentiation Operator

この記事は JavaScript stage 0,1,2,3 Advent Calendar の2日目の記事です。書けるところまで一人で書いてみようと思ってみました。

ちなみに執筆当時は stage 3 です

Exponentiation Operator はいわゆるべき乗を行う新しい演算子です。 JavaScript には Math.pow という関数がありますが、あれをやるための演算子です。

let squared = 2 ** 2;
// same as: 2 * 2

let cubed = 2 ** 3;
// same as: 2 * 2 * 2

let a = 2;
a **= 2;
// same as: a = a * a;

let b = 3;
b **= 3;
// same as: b = b * b * b;
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?