6 Solo Flight. Why is this creating an infinite loop?


#1



6 solo flight


freezes my browser because of infinite loop. I'm confused because i thought soloLoop = 2 would make it false, maybe I'm just missing something.


var soloLoop = function(){
    var soloLoop = 0;
    while(soloLoop < 1);{
      console.log("Looped once!");
      soloLoop = 2;
  }
  
};

soloLoop();


#2

It doesn't look like you followed the instruction(s).

Inside the soloLoop function, write a while loop that takes an initial condition that's true. Your loop should log "Looped once!" to the console, then change that initial condition to false.MAKE SURE to set your condition to false in the body of your loop. Otherwise, you'll loop forever!

Well, this is what you're to do:

//Remember to make your condition true outside the loop!
var condition = true;

var soloLoop = function() {
    while (condition) {
  //Your code goes here!
  console.log("Looped once!");
  condition = false;
    }
};


soloLoop();