r/JavaScriptTips • • Jan 18 '23

CodeHS - 2.9.8 Stop Light

/r/learnjavascript/comments/10fbrqg/codehs_298_stop_light/
0 Upvotes

1 comment sorted by

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

}