6. Solo Flight - help!



Infinite Loop :frowning:

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




This code:

myCondition = true

changes value of myCondition to true. It's fine, but this statement always returns true, so it should not be used as a condition in the while loop. It's never a good idea to use assign operation as a condition.

You should use one of the comparison operators (>, <, >=, <=, ===, !==, ==, !=) instead of =.


I've edited these statements now to ==, but I still get the infinite loop - what's causing this? Thanks! :slight_smile:


Please post your code after correction. I don't see any other errors. And your code should work fine, take a look -> https://repl.it/Dp16/0


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