OpenAI frontend engineer interviews emphasise JavaScript, DOM manipulation, CSS, accessibility, browser APIs, and UI component architecture.
cd command. Given a current directory path and a relative destination path, return the final absolute...Input: Given inputmalloc and free operations with efficient...Input: Linked list"A.B.C.D", where each octet is an...Input: Stringmessages and a number k, write a function that returns the last k messages sent to the chatbot.function getLatestMessages(messages: string[], k: number): string[]getLatestMessages(["Hello", "How can I assist you?", "What is OpenAI?", "I love AI!"], 2)['What is OpenAI?', 'I love AI!']messages array will have at least one message and at most 10^4 messages.k will be a positive integer not exceeding the number of messages.Promise that includes unique features tailored to OpenAI's needs.Promise class complying with the following methods:resolve(value: any): void — resolve the promise with the given value.reject(reason: any): void — reject the promise with the given reason.then(onResolved: Function, onRejected: Function): Promise — register callbacks to receive either a resolved value or a rejection reason, and return a new promise resolving to the return value of the called callback.then calls.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