We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c4a01c2 commit ab7db6bCopy full SHA for ab7db6b
.DS_Store
0 Bytes
Week1/.DS_Store
6 KB
Week1/prep-exercises/.DS_Store
Week1/prep-exercises/1-traffic-light/traffic-light-1.js
@@ -12,10 +12,15 @@ while (rotations < 2) {
12
const currentState = trafficLight.state;
13
console.log("The traffic light is on", currentState);
14
15
- // TODO
16
- // if the color is green, turn it orange
17
- // if the color is orange, turn it red
18
- // if the color is red, add 1 to rotations and turn it green
+ if (currentState === "green") {
+ trafficLight.state = "orange" ;
+
+ }else if (currentState=== "orange") {
19
+ trafficLight.state= "red";
20
+ } else if (currentState === "red") {
21
+ rotations++;
22
+ trafficLight.state= "green" ;
23
+ }
24
}
25
26
/**
0 commit comments