+ 4
How do you add in a different order other than i++ ?
Iām a Rookie to JavaScript and Iām really interested to know how do u add number in, 2ās and 3ās and 4ās or any other synonymous way other than i++! I hope someone will come with a great example along with explanation ! Thanks in advance š
4 Answers
+ 17
i++ is the same as i+=1 and i=i+1
There is no other way to add 2 to i except i+=2 or i=i+2
+ 5
Thanks a lot @Swapnil!
I thought it would be more complicated but never realised it would be this easy š
šš»š
+ 4
Yea Iām getting a catch on to it now! Thanks man @ashish kumar
+ 2
++i and i++ are same when initialsed to a variable. Any of both can be used, only difference being in '++i' the value is incremented first and then used while in 'i++' the value of i is used and then decremented. As said by Swapnil i=i+1 and i+=1 are equal and can be used anywhere possible.