Whats wrong with my code?


#1

//Remember to make your condition true outside the loop!

var soloLoop = function(){
var soloLoop = true;
while(soloLoop < 0) {
console.log("Looped once!");
soloLoop = false;
}
};

soloLoop(console.log);

The error asks me if "Did you log "Looped once!" to the console?"
I don't understand because i already logged it into the console


Unexpected end of script : Solo flight
#2

You call the function here:

soloLoop(console.log);

but for some reason you gave it an argument console.log, while your function doesn't take any arguments


#3

@parthmohanty

Hi,

In the variable soloLoop you've created, it has like value true so a Boolean value. Here, you're testing whether soloLoop is less than 0. You can't test whether true is less than 0. Remove this condition and instead check whether soloLoop is equal to true so it can loop at least one time. Remember to use === sign of comparison instead of = sign for assigning value.