Custom Event Emitter / PubSub
mediumDOM & UtilitiesHigh freq+250 XPFrontend AlgoArena
Event emitters power Node.js and DOM events. Implement an EventEmitter class.
What it has to do
.on(event, listener)registers a listener callback..emit(event, ...args)calls all registered listeners with args..off(event, listener)unregisters a specific listener.
Where it's been asked
- Meta
- Atlassian
From public interview reports — a problem very like this one has shown up in a round at these companies. Not an exhaustive list.
Try it yourself· Edit the code, then press Run
Loading playground...
Ready to check it?
1 tests run against your code, right here in your browser. Sign in to claim the XP when you pass.
Need a nudge?
Reveal a conceptual hint or the reference solution. Both were written and reviewed with the problem — no runtime magic.
Discussion
Sign in to postSign in to join the conversation.Sign in
No comments yet. Be the first to say something.