Level 33

emit is synchronous

An EventEmitter with one listener. Is emit async?

const { EventEmitter } = require('node:events');const bus = new EventEmitter();bus.on('order', () => console.log('listener'));console.log('before');bus.emit('order');console.log('after');

1. Predict the output

Tap the lines in the order you think they print.

  1. 1…
  2. 2…
  3. 3…