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

= - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

=

20157

=

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

js
x = y

js
// 
//  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