What is EventEmitter in Node.js?
EventEmitter class lies in the events module and is accessibly through the following syntax:
//import events module
var events = require('events');
//create an eventEmitter object
var eventEmitter = new events.EventEmitter();
In case an EventEmitter instance is facing error, it emits 'error' event. When a new listener is added, the 'newListener' event gets fired and when a listener gets removed, 'removeListener' event gets fired.
BY Best Interview Question ON 29 Jun 2020