Search⌘ K
AI Features

Exercise: Ticker

Explore how to write a Node.js function that emits tick events every 50 milliseconds until a specified time elapses. Learn to use EventEmitter along with callbacks to handle asynchronous events effectively. Understand recursive timeouts and event-driven design to manage timing and event emissions in your Node.js applications.

Problem statement

Write a function that accepts a number and a callback as the arguments. The function should return an EventEmitter instance that emits an event called tick every 50 milliseconds until the number of milliseconds is passed from the invocation of the function. The function should also call the callback when the number of milliseconds has passed, providing the total count of tick ...