Panda Guru LogoPanda
Guru

Problem: Simple Observable Implementation asked in Uber

Round 1

Questions: Create a simple Observable class that implements the observer pattern. The class should:

const observable = new Observable(); // Subscribe to changes const subscription = observable.subscribe(data => { console.log('Received:', data); }); // Notify subscribers observable.notify('Hello!'); // logs: "Received: Hello!" // Unsubscribe subscription.unsubscribe(); // No longer logs anything observable.notify('Hello again!');
Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.