OpenAI frontend engineer interviews emphasise JavaScript, DOM manipulation, CSS, accessibility, browser APIs, and UI component architecture.
NotificationSystem that manages subscribers and notifications. Implement the following methods:subscribe(clientId: string, callback: Function): void — register a client with a callback to be notified.unsubscribe(clientId: string): void — remove a client from the list of subscribers.notify(message: string): void — send a message to all registered clients.const notificationSystem = new NotificationSystem();notificationSystem.subscribe('client1', (msg) => console.log(msg));notificationSystem.notify('New message received!');New message received!notify is called.Constraints:Router that manages routes in an SPA. You should implement the following methods:addRoute(path: string, callback: Function): void — register a route with a specific path and callback function.navigate(path: string): void — navigate to the specified path and call the associated route's callback.getCurrentPath(): string — return the current path of the application.const router = new Router(); router.addRoute('/home', () => console.log('Home Page')); router.navigate('/home');Home PageSign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free