how do an infinite loop in javascript

前端 未结 3 475
再見小時候
再見小時候 2021-01-29 16:33

Im trying to do an infinite loop using while between 0 to 100 and 100 to 0, but the browser crashes. There is a way to clear the browser memory? This is my code:



        
3条回答
  •  星月不相逢
    2021-01-29 16:51

    You just need an infinite loop? If so just do

    for(var i = 0; i < 1;){
      console.log('infinite');
    };
    

    if you need with a while

    var = 0;
    while(var < 1){
      console.log('looOOoOOoOoOp');
    };
    

提交回复
热议问题