| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Subtraction_assignment | [Back] [Original] |
Get to know MDN better
let a = 2;
console.log((a -= 3));
// Expected output: -1
console.log((a -= "Hello"));
// Expected output: NaN
x -= y // x = x - y
let bar = 5;
bar -= 2; // 3
bar -= "foo"; // NaN
| ECMAScript 2027 LanguageSpecification # sec-assignment-operators |
| Web Proxy Viewer | New URL | Original Page |