[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Subtraction_assignment [Back]  [Original]

-= - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

-=

20157

-=

let a = 2;

console.log((a -= 3));
// Expected output: -1

console.log((a -= "Hello"));
// Expected output: NaN

js
x -= y // x = x - y

js
let bar = 5;

bar -= 2; // 3
bar -= "foo"; // NaN

ECMAScript 2027 LanguageSpecification
# sec-assignment-operators


Web Proxy Viewer  |  New URL  |  Original Page