What am I doing wrong? Im still get a infinity loop


#1



I kept getting the loop and everything seems to be looking right. I bet it's something small but I can't seem to figure out what is wrong.


// Write your code below!
var b = true;
var g = 1;
for(var i = 1; i < 10; i++){
    console.log(i);
}
while(b){
    console.log("Because i care");
    b = false;   
}

do{
    console.log("DO NOHTING");
}while(g < 8);
g++;


#2

here:

do{
    console.log("DO NOHTING");
}while(g < 8);
g++;

you increase g outside the loop, thus the condition of the loop never becomes false.


#3

Yes, I just looked it over one last time, and I thought that looked wrong, so I changed it and it worked just fine;


#4