๋นผ๊ธฐ ํ ๋น (-=)
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 = 2;
console.log((a -= 3));
// Expected output: -1
console.log((a -= "Hello"));
// Expected output: NaN
๊ตฌ๋ฌธ
js
x -= y; // x = x - y
์์
๋นผ๊ธฐ ํ ๋น ์ฌ์ฉํ๊ธฐ
js
// bar = 5
// ์์ ๊ฐ์ ๋ณ์๋ฅผ ๊ฐ์ ํ ๋
bar -= 2; // 3
bar -= "foo"; // NaN
๋ช ์ธ
Specification |
---|
ECMAScriptยฎ 2026 Language Specification # sec-assignment-operators |
๋ธ๋ผ์ฐ์ ํธํ์ฑ
Loadingโฆ