Q7: What is EventEmitter and how is it used?

EventEmitter is a core module class that allows objects to emit named events that trigger registered listener functions.

Key Takeaways
  • Implements the publisher-subscriber design pattern in Node.js.
  • Used heavily across built-in modules like HTTP and Streams.
Knowledge Check

Which method is used to attach a one-time event listener in EventEmitter?