MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/JavaScriptTips/comments/10fbt7w/codehs_298_stop_light/
r/JavaScriptTips • u/Common-Passenger5222 • Jan 18 '23
1 comment sorted by
1
Not going to do your homework for you, but I am happy to clean up your syntax a little. Biggest issue is that “=“ is not the same thing as “==.”
var lightColor = readLine("What color is the light? ");
if (lightColor == "green"){
println("Go");
} else if (lightColor == "red"){
println("Stop");
} else if (lightColor == "yellow"){
println("Slow");
}
1
u/Puripnon Jan 19 '23
Not going to do your homework for you, but I am happy to clean up your syntax a little. Biggest issue is that “=“ is not the same thing as “==.”
var lightColor = readLine("What color is the light? ");
if (lightColor == "green"){
println("Go");
} else if (lightColor == "red"){
println("Stop");
} else if (lightColor == "yellow"){
println("Slow");
}