📌  相关文章
📜  a++ 和 ++a 之间的 javascript 差异 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:45.944000             🧑  作者: Mango

代码示例1
// ++i returns the value of i after it has been incremented. i++ returns the value of i before incrementing.

// When the ++ comes before its operand it is called the "pre-increment" operator, and when it comes after it is called the "post-increment" operator.

// This distinction is only important if you do something with the result.

var i = 0, j = 0;

alert(++i);  // alerts 1
alert(j++);  // alerts 0