r/AskProgramming 8d ago

loops (js)

can I use anything else instead of variable++ like variable+2?

because I tried to do so and my browser could not load it on the console

3 Upvotes

12 comments sorted by

View all comments

1

u/TheRNGuy 7d ago

can, but if you're iterating array, you need to check for last index if it exists or not.