Finding bug


#1

i have a bug in introduction to while loops in JS , chapter 5 pratice make perfect
after i click save and submit the page suddenly not responsive i restart the page but still cant
this problem is already few day i cant continue learning like that please help me


#2

sounds like a infinity loop, please copy paste your code to the forum so we can help you


#3

//Remember to set your condition outside the loop!
var count = 0 ;

var loop = function(){
while(count < 3){
console.log ("i'm looping") ; //Your code goes here!
}
};

loop();


#4

count is and stays zero? so the loop condition will always evaluate to true, zero is smaller then 3


#5

then shoulod i change the count to number greater then 3 ?


#6

inside the loop i would increase count so that eventually the loop condition becomes false after several iterations


#7

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