Computer scienceBackendNode.jsCore ConceptsInternal modulesEventsEvents module basics

Intro to events module

Consequences of lack of sleep

Report a typo

The sleepy programmer did not notice how he fell asleep on the keyboard! In the morning, he saw that the code that greeted the person with the name in the userName variable was corrupted. Help him recover the code in the indicated places.

Write a program in JavaScript
const EventEmitter = require('events'); //do not change this line!

const emitter = new EventEmitter();

emitter.on('greeting', (name) => {
console.log(`Good morning, ${}!`); // this line is corrupted
});

const userName = 'Boris';

emitter.emit('greet", ); // this line is corrupted
___

Create a free account to access the full topic