Solo flight; syntax error: unexpected end of input....HELP!


#1

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

soloLoop();


#2

You're missing one curly bracket for the function you created before the quoted above.

};

You then should have:

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


soloLoop();

#3

it worked. thanks.....


#4

You're welcome.

Have fun coding! :slight_smile:


#5

count = 0;
while( i < 20){
console.log(i);
count+++;
i= true;
};
for( var i === 0; i > 20; i++){
console.log(i);
};
whats wrong with this code please


#6

You assign true to i at the end of the while loop which will make it run forever.


#7

Erhmm...

What are you trying to achieve here:

Also, why this?

You really should have opened a new discus for this. :slight_smile:


#8

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