Course · Section 14: Object-Oriented Programming (OOP) With JavaScript · Lecture 226: ES6 Classes
Model a traffic light cycling red, green, yellow, then back to red. Implement `TrafficLight` (starts red): - `next()` advances to and returns the next state. - `current()` returns the current state.
+ 1 hidden test run on Submit.
A state-transition table advances the light deterministically through its cycle.
Run your code to see results.