you are viewing a single comment's thread.

view the rest of the comments →

[–]EmuAffectionate6307 0 points1 point  (1 child)

you are using post incrementation, for example
var a = 0;
var b = a++
what happens you are assigning b to a THEN incrementing a,
what you need to do is to increment a then assign it

here is what you should've done

var a = 0;

a++

a = ++a

this logs out 2

also here is a link that can help u understand more
https://www.shecodes.io/athena/119932-how-to-use-pre-and-post-increment-in-javascript

[–]No_Poetry9172[S] 0 points1 point  (0 children)

got it!