| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Decrement | [Back] [Original] |
Get to know MDN better
let x = 3;
const y = x--;
console.log(`x:${x}, y:${y}`);
// Expected output: "x:2, y:3"
let a = 3;
const b = --a;
console.log(`a:${a}, b:${b}`);
// Expected output: "a:2, b:2"
x--
--x
x--
--x
--(--x); // SyntaxError: Invalid left-hand side expression in prefix operation
let x = 3;
const y = x--;
// x = 2
// y = 3
let x = 3;
const y = --x;
// x = 2
// y = 2
| ECMAScript 2027 LanguageSpecification # sec-postfix-decrement-operator |
| Web Proxy Viewer | New URL | Original Page |