When to while and when to for - why is is this an infinite loop?


#1


Why is this an infinite loop?


for(i=0; i<99; i+6){
    console.log(i)}


#2

because the value of i is always 0

your code should be like

for(i=0; i<99; i=i+6){
    console.log(i)}

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.