Solo Flight


#1


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

soloLoop();



//Why does my code keep crashing the browser???? I closed the loop :frowning:


#2

Got it. removed "=true"


#3

Yes = assigns where you seek to compare (== or ===). Also an assignment has the value you assign which is in this case true, which can become a program as you experienced.

As a condition searches for a value of true or false you could as well use the variable (here: zift) as well as it contains a boolean value already. But in case zift is not a boolean it would be better to use == or === for comparison.


#4

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