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