6. Solo Flight


#1

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

var soloLoop = function(){
while (soloLoop() == true)
console.log('Looped Once!');
soloLoop = false;

};

soloLoop()

//What am i doing wrong??
// Error is RangeError: Maximum call stack size exceeded, but the loop should stop once told that soloLoop = false!


#2

change the name of the function.
because you already set soloLoop= true
now

while (soloLoop() == true) // here missed a { bracket
and remove () brackets
here soloLoop() means you are calling the soloLoop function inside the same function thats not possible causing error Maximum call stack size exceeded
your code should be like

while (soloLoop== true){

next you have to close the function adding a } bracket
then call the function by function name
soloLoop() // change it


#3

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