除算代入 (/=)

除算代入演算子 (/=) は変数を右オペランドの値で除算し、結果をその変数に代入します。

試してみましょう

構文

x /= y // x = x / y

除算代入の使用

// 以下の変数があり、すべての演算がこの順に実行されると想定する
//  bar = 5

bar /= 2     // 2.5
bar /= 2     // 1.25
bar /= 0     // Infinity
bar /= 'foo' // NaN

仕様書

Specification
ECMAScript Language Specification
# sec-assignment-operators

ブラウザーの互換性

BCD tables only load in the browser

関連情報