Coding task · JavaScript and TypeScript course · Module 9: Design Patterns and Architecture
Exercise: Time Simulation
Implement a time simulation with a loop, a day/night cycle and notifications about hour changes.
Task
The index.js file has a TimeSimulation class. Fill in the blanks: ___BLANK1___ is the number of hours in a day, after which the hour counter goes back to 0 (tick() after 23:00 gives 0:00 and the next day), ___BLANK2___ is the logical operator in isNight(), because the night is the hours from 20 to 23 and from 0 to 5, and ___BLANK3___ is the browser function that calls tick() every intervalMs milliseconds until clearInterval. A second call to start() must not start a second loop, and stop() stops it.