Coinbase frontend engineer interviews emphasise JavaScript, DOM manipulation, CSS, accessibility, browser APIs, and UI component architecture.
KnowledgeBaseSystem that stores articles with CRUD operations. The system operates entirely...Input: Graph (nodes and edges)createAccountManager(initialBalance: number): { deposit: Function; withdraw: Function; getBalance: Function; } that returns an object with methods to deposit, withdraw, and getBalance. Using closures, ensure that the balance is encapsulated and not directly accessible.deposit(amount: number): void — Adds an amount to the balance.withdraw(amount: number): void — Reduces the balance by the specified amount if sufficient funds are available.getBalance(): number — Returns the current balance.Example 1:const account = createAccountManager(100); account.deposit(50); account.getBalance();150account.withdraw(30); account.getBalance();120initialBalance is a non-negative integer.simulateEventLoop(tasks: Array<Promise<void>>): void that takes an array of promises representing asynchronous tasks and executes them in a way that reflects the behavior of the event loop. Ensure that any tasks scheduled in the event loop (using setTimeout or similar) are executed only after the current stack is clear.simulateEventLoop(tasks: Array<Promise<void>>): void — Simulates the event loop and executes tasks in order.Example 1:simulateEventLoop([Promise.resolve(), new Promise((res) => setTimeout(res, 100)), Promise.resolve()])Executed (in order: resolve, wait, resolve)simulateEventLoop([new Promise((res) => setTimeout(res, 50)), Promise.resolve(), new Promise((res) => setTimeout(res, 20))])Executed (in order: wait 50ms, resolve, wait 20ms)Constraints:1 <= tasks.length <= 10^4Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free