Question from the Node.js - Fundamentals test

Write a Node.js code that emits an event and logs it to the console.

Easy

In the following Node.js code, what will be the result?

const EventEmitter = require('events');
class MyEmitter extends EventEmitter {}

const myEmitter = new MyEmitter();
myEmitter.on('event', () => {
  console.log('an event occurred!');
});

myEmitter.emit('event');
Author: AxelStatus: Published(Update)Question passed 506 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!