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

Why am I getting a pop up for if block ? In Level 4 Lesson 4

let signal = "yellow";
// write logic here
if (signal === 'green') {
console.log('Go');
} else if (signal === 'yellow') {
console.log('Wait');
} else if (signal === 'red') {
console.log('Stop');
} else {
console.log('Error');
}

This is my code and I guess it's right then too its not getting passed. Please look into it
by

1 Answer

iamabhishek
You can use === also for matching values, but for this exercise please use ==.
Here is the correct code:

let signal = "yellow";
// write logic here
if(signal == 'green'){
console.log('Go');
} else if(signal == 'yellow'){
console.log('Wait');
} else if(signal == 'red'){
console.log('Stop');
} else{
console.log('Error');
}

Login / Signup to Answer the Question.