Interview practice question
Implementing a simple event emitter
Frontend Engineering · JavaScript Core · Intermediate
How would you implement a simple event emitter with on, off and emit?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Map of event name → Set of handlers.
- on adds, off removes.
- emit calls handlers with args.
- once helper.
- Error isolation, return unsubscribe.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.