Flipkart interview question

Implement an event emitter listener in javascript.