Get your own Node server
const EventEmitter = require('events');
const emitter = new EventEmitter();

// Emit event with arguments
emitter.on('userJoined', (username, userId) => {
  console.log(`${username} (${userId}) has joined the chat`);
});

emitter.emit('userJoined', 'Kai', 42);
// Outputs: Kai (42) has joined the chat

              
Kai (42) has joined the chat