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

Level 4 Lesson 4...The if...else if statement.

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");
}

It's giving me "Try again"
What am I doing wrong?
by

2 Answers

kshitijrana14
Try this one

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");
}
Darshan1y7sx
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");
}

try this one it will work 100%

Login / Signup to Answer the Question.