Level 4 > lesson 4
let signal = "green";
if(signal=="yellow"){
console.log("Wait");
}
else if ( signal == "yellow" && !"green"){
}
else if (signal =="yellow" && !"red"){
console.log("Wait");
}
else if (signal =="green"){
console.log("Go");
}
else if (signal == "green" && !"yellow"){
console.log("Go");
}
else if ( signal == "green" && !"red"){
console.log("GO");
}
else if ( signal=="red"){
console.log("Stop");
}
else if (signal == "red" && !"yellow"){
console.log("Stop");
}
else if (signal == "red" && !"green"){
console.log("Stop");
}
else{
console.log("Error");
}
Hello!
how did you guys make this code execute and proceed to the next level. Is there a much more simple way to write this code and please correct me where I am getting it wrong.
Thank you!