Archived
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');
-1
Community EvaluationsNo one has reviewed this question yet, be the first!
2
Which class is used to create custom events in Node.js?2
Install a NPM package via CLI4
How to start a NodeJS server8
What is the best practice to apply in your code to improve the performance of your application?2
Write a Node.js code that emits an event and logs it to the console.1
Start a REPL session on Node.js1
What does npm mean?