๋๋๊ธฐ ํ ๋น (/=)
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itโs been available across browsers since โจ2015๋ 7์โฉ.
๋๋๊ธฐ ํ ๋น ์ฐ์ฐ์(/=
)๋ ์ค๋ฅธ์ชฝ ํผ์ฐ์ฐ์์ ๊ฐ์ผ๋ก ๋ณ์๋ฅผ ๋๋ ๊ฒฐ๊ณผ๋ฅผ ๋ค์ ๋ณ์์ ํ ๋นํฉ๋๋ค.
์๋ํด ๋ณด๊ธฐ
let a = 3;
a /= 2;
console.log(a);
// Expected output: 1.5
a /= 0;
console.log(a);
// Expected output: Infinity
a /= "hello";
console.log(a);
// Expected output: NaN
๊ตฌ๋ฌธ
js
x /= y; // x = x / y
์์
๋๋๊ธฐ ํ ๋น ์ฌ์ฉํ๊ธฐ
js
// bar = 5
// ์์ ๊ฐ์ ๋ณ์๋ฅผ ๊ฐ์ ํ๊ณ , ์๋์ ๋ชจ๋ ์ฐ์ฐ์ ์์๋๋ก ์คํํ ๋
bar /= 2; // 2.5
bar /= 2; // 1.25
bar /= 0; // Infinity
bar /= "foo"; // NaN
๋ช ์ธ
Specification |
---|
ECMAScriptยฎ 2026 Language Specification # sec-assignment-operators |
๋ธ๋ผ์ฐ์ ํธํ์ฑ
Loadingโฆ