Development Tools Website Optimization Chrome DevTools Basics The Profiles Panel

How to create a loop

Hi everyone ! I am a bit confused, in this video a loop is create like this :

var  i = 0;
for(;;){
  i++;
  if (i == 10000000)
}

Isn't it supposed to be like this ? :

for (var i =0; i<10000000; i++)

1 Answer

William Li
PRO
William Li
Pro Student 26,828 Points

for(;;) is unconditional for loop, meaning the loop will go on forever, unless there's break or something to terminate it in the loop body.

Thanks !