You are given a program that already has a listener for the sum event. You should use the emit method to trigger an event so that the string with the sum of the numbers 1 and 4 is displayed on the console.
Intro to events module
The sum
Report a typo
Write a program in JavaScript
const EventEmitter = require('events'); //do not change this line!
const emitter = new EventEmitter();
emitter.on('sum', (firstNum, secondNum) => {
console.log(`The sum is ${firstNum + secondNum}`);
});
emitter.emit(/* your code */);
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.