Understanding Incrementing

前端 未结 7 2127
别那么骄傲
别那么骄傲 2020-11-27 22:31

For example this:

var a = 123;
var b = a++;

now a contains 124 and b contains 123

7条回答
  •  清酒与你
    2020-11-27 23:16

    This is the standard way of doing it. The postincrement operator assigns the value and then increments.

    The preincrement (++a) operator increments and then assigns.

    I am not familiar with php and cannot say how it does it or why.

提交回复
热议问题