Solo Flight | Question


I past this lesson, but I got a question. Why do I need to write 'real = false' instead of 'var real = false' after the console.log?
Just want to know the reason.


//Remember to make your condition true outside the loop!
var real = true
var soloLoop = function(){
console.log("Looped once!");
real = false;




otherwise real will stay true which means you have an infinity loop


Also you don't have to use 'var real = false;' because you only need to declare a variable with 'var' the first time you use it.


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