DEV Community 👩‍💻👨‍💻

Discussion on: problem with this Javascript code, im noob btw

mranyx profile image

Yeah, i forgot that point, if you're using a while loop, you should increment i before the if statement. otherwise, it will create an infinite loop. If you're using a for loop, the code i wrote above is OK