| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Assignment | [Back] [Original] |
Get to know MDN better
let x = 2;
const y = 3;
console.log(x);
// Expected output: 2
console.log((x = y + 1)); // 3 + 1
// Expected output: 4
console.log((x = x * y)); // 4 * 3
// Expected output: 12
x = y
//
// x = 5
// y = 10
// z = 25
x = y; // x 10
x = y = z; // x, y 25
| ECMAScript 2027 LanguageSpecification # sec-assignment-operators |
| Web Proxy Viewer | New URL | Original Page |