Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 09a0b05

Browse files
committed
minor changes
1 parent 78e7a86 commit 09a0b05

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

Week1/prep-exercises/1-traffic-light/traffic-light-1.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
"use strict";
22
/**
3-
* The `state` property says what the traffic light's state (i.e. colour) is at
3+
* The `state` property says what the traffic light's state (i.e. color) is at
44
* that moment.
55
*/
66
const trafficLight = {
7-
state: "green",
7+
state: "green",
88
};
99

1010
let rotations = 0;
1111
while (rotations < 2) {
12-
let currentState = trafficLight.state;
13-
console.log("The traffic light is on", currentState);
12+
const currentState = trafficLight.state;
13+
console.log("The traffic light is on", currentState);
1414

15-
// TODO
16-
// if the color is green, turn it orange
17-
if (currentState === "green") {
18-
trafficLight.state = "orange";
19-
}
20-
// if the color is orange, turn it red
21-
else if (currentState === "orange") {
22-
trafficLight.state = "red";
23-
}
24-
// if the color is red, add 1 to rotations and turn it green
25-
else {
26-
trafficLight.state = "green";
27-
rotations++;
28-
}
15+
// TODO
16+
// if the color is green, turn it orange
17+
if (currentState === "green") {
18+
trafficLight.state = "orange";
19+
}
20+
// if the color is orange, turn it red
21+
else if (currentState === "orange") {
22+
trafficLight.state = "red";
23+
}
24+
// if the color is red, add 1 to rotations and turn it green
25+
else {
26+
trafficLight.state = "green";
27+
rotations++;
28+
}
2929
}
3030

3131
/**

Week2/prep-exercises/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)