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

%= - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

%=

20157

%=

let a = 3;

console.log((a %= 2));
// Expected output: 1

console.log((a %= 0));
// Expected output: NaN

console.log((a %= "hello"));
// Expected output: NaN

js
x %= y // x = x % y

js
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