Click in order · JavaScript and TypeScript course · Module 9: Design Patterns and Architecture
Sorting: Observer Pattern
Arrange the elements of the Observer pattern:
Items to click
- constructor() { this.listeners = [] }
- on(event, fn) { this.listeners.push({event, fn}) }
- emit(event) { ... } }
- class EventEmitter {
You can check the correct answer by solving this task in the CodeWorlds game.