What if you were asked to do this without a for loop? ;)
While loop saves the day!
Or better yet ... use some functional programming!
.map((_, i) => i + 1)
.filter((num) => num % 2 !== 0)
in that case, see some of the other clever comments to the post :)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.