+ 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 RĂ©ponses
+ 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.