累乗・平方根・立方根を計算する
Math.pow(2, 10); // 1024 2 ** 10; // 1024 (ES2016の**演算子) Math.sqrt(16); // 4 Math.cbrt(27); // 3 Math.hypot(3, 4); // 5 (ピタゴラスの定理)
ES2016以降は**演算子が使えてより自然に書ける。Math.hypotは複数引数を渡してベクトルの長さ計算にも使える。
Math.min() / max() / abs()
Math.floor() / ceil() / round() / trunc()
parseInt() / parseFloat() / Number()
Number.isNaN() / isFinite() / isInteger()
前の関数
Math.random()
次の関数
toFixed() / toPrecision() / toLocaleString()