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

Facing issue in Level 5 - Lesson 2 in JS Course

output coming and counter variable also initialized but not taking

let i;
// write your code here
for(let counter=1;counter<=20;counter++)
{
if(i%2==0);
counter+=1;
{
console.log(counter + " ");
}
}
by

2 Answers

kshitijrana14
Try this one
let i;
// write your code here
for(i=2;i<=20;i+=2)
{
console.log(i + " ");
}
Ananthmrfji
try the below code:
let i=2;
for(i=2; i<=20;i+=2)
{
console.log(i + " ");
}

Login / Signup to Answer the Question.