Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Level 5 Lesson 5-->Getting required output but

Added if conditions correct only and out put also showing 0,1,2,3,4,5 but we are getting below error
Is the condition correct for the if statement, do check it!
let x = 0;

while(x < 10)
{
console.log(x);
if(x>=5)
break;
x++;
}
by

1 Answer

sam5epi0l
You haven't implemented if block correctly. Use Opening and closing curly brackets


let x = 0;

while(x < 10)
{
console.log(x);
if(x == 5) {
break;
}
x++;
}

Login / Signup to Answer the Question.