Domanda

I'm pushing a script through JSLint like rocks through a food mill. Slowly, and with a lot of grinding.

I have updated all the i++ incrementers to i+=1. What should I do in the case of ++i, as in, b = ++i ?

È stato utile?

Soluzione

Preincrement (++i) adds one to the value of i, then returns i. You get the same effect if you put them on separate lines.

i += 1;
b = i;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top