Complete the code to import the EventEmitter class from the 'events' module.
const [1] = require('events');
The EventEmitter class is imported from the 'events' module to create event-driven behavior.
Complete the code to create a new instance of EventEmitter.
const emitter = new [1]();You create a new event emitter by calling new EventEmitter().
Fix the error in the code to listen for the 'start' event.
emitter.[1]('start', () => { console.log('Started'); });
The correct method to listen for events is on. It registers a callback for the event.
Fill both blanks to emit a 'data' event with a message.
emitter.[1]('[2]', 'Hello World');
Use emit to trigger an event. The event name here is data.
Fill all three blanks to create an event listener that logs the received message.
emitter.[1]('message', ([2]) => { console.log([3]); });
Use on to listen for 'message' events. The callback receives the message as msg and logs it.
