Exercise: Ticker
Practice how to emit an event and count the number of ticks after invoking a function.
We'll cover the following
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
events emitted as the result.
If you’re unsure about how to do this, click the “Show Hint” button.
Get hands-on with 1400+ tech skills courses.