The Mentoxis GuideFor senior and staff frontend candidates
Predict the output: 52 practice questions 40 output questions and 12 quick checks from the guide, in learning order. Type what you think the code prints, check it line by line, then read why. Want everything in one place? Get the free PDF .
Show All questions Unanswered only Review mistakes
PriorityAll priorities P0 · Must know P1 · High P2 · Good to have StageAll stages 1. Language core (20) 2. Asynchronous JavaScript (14) 3. Browser platform (5) 4. Quality at scale (6) 5. Building UIs (7) 52 questions
Stage 1 Language coreHow JavaScript runs your code (hoisting) 1 Predict the output console.log(typeof foo); P1 · High P1 · High Not answered yet
2 Predict the output var x = 1; P1 · High P1 · High Not answered yet
3 Predict the output let a = 'outer'; P1 · High P1 · High Not answered yet
Types, equality and coercion 4 Predict the output console.log([] + []); P1 · High P1 · High Not answered yet
5 Predict the output console.log(0 == '', null == undefined, null === undefined, null == 0); P1 · High P1 · High Not answered yet
6 Predict the output console.log(['1', '2', '3'].map(parseInt)); P1 · High P1 · High Not answered yet
Scope and closures 7 Predict the output const fns = []; P0 · Must know P0 · Must know Not answered yet
8 Predict the output function outer() { P0 · Must know P0 · Must know Not answered yet
9 Predict the output let x = 1; P0 · Must know P0 · Must know Not answered yet
Currying and the infinite add 10 Predict the output const add3 = curry((a, b, c) => a + b + c); P1 · High P1 · High Not answered yet
11 Predict the output console.log(+add(1)(2)(3)(4), `${add(5)(5)}`, add(1)(2) + 1); P1 · High P1 · High Not answered yet
The value of this 12 Predict the output const user = { P0 · Must know P0 · Must know Not answered yet
13 Predict the output function show() { return this.v; } P0 · Must know P0 · Must know Not answered yet
Objects: creating them and property settings 14 Predict the output const cfg = Object.freeze({ level: 1, opts: { debug: false } }); P2 · Good to have P2 · Good to have Not answered yet
Prototypes and inheritance 15 Predict the output function Person(name) { this.name = name; } P1 · High P1 · High Not answered yet
16 Predict the output const base = { greet: 'base' }; P1 · High P1 · High Not answered yet
Array method polyfills: reduce and map 17 Predict the output try { [].reduce((a, b) => a + b); } catch (e) { console.log(e.message); } P2 · Good to have P2 · Good to have Not answered yet
Copying and comparing data: deep clone and deep equal 18 Predict the output const a = { n: 1, inner: { m: 1 } }; P1 · High P1 · High Not answered yet
19 Predict the output const data = { d: new Date(0), u: undefined, n: NaN, f() {} }; P1 · High P1 · High Not answered yet
Working with nested data: flatten arrays and objects 20 Predict the output console.log([1, [2, [3]]].flat()); P1 · High P1 · High Not answered yet
Stage 2 Asynchronous JavaScriptThe event loop: tasks, microtasks and rendering 21 Predict the output console.log('1'); P0 · Must know P0 · Must know Not answered yet
22 Predict the output console.log('A'); P0 · Must know P0 · Must know Not answered yet
23 Predict the output new Promise(resolve => { P0 · Must know P0 · Must know Not answered yet
Callbacks, promises and async/await 24 Predict the output Promise.resolve(1) P0 · Must know P0 · Must know Not answered yet
25 Predict the output async function f() { P0 · Must know P0 · Must know Not answered yet
26 Predict the output const wait = ms => new Promise(r => setTimeout(r, ms)); P0 · Must know P0 · Must know Not answered yet
Promise.all, allSettled, race, any, and running a few at a time 27 Predict the output const p1 = new Promise(r => setTimeout(() => r('slow'), 100)); P0 · Must know P0 · Must know Not answered yet
28 Predict the output const wait = ms => new Promise(r => setTimeout(r, ms)); P0 · Must know P0 · Must know Not answered yet
Retry with exponential backoff 29 Predict the output let calls = 0; P0 · Must know P0 · Must know Not answered yet
Debounce and throttle 30 Quick check A user types react, one letter every 50 ms, into a search box with a 300 ms debounce. How many searches run, and for what text? P0 · Must know P0 · Must know Not answered yet
31 Quick check The same typing with a 300 ms throttle (first and last call both run). What happens? P0 · Must know P0 · Must know Not answered yet
Pub/sub: build an event emitter 32 Predict the output const e = new EventEmitter(); P0 · Must know P0 · Must know Not answered yet
Async utilities from real interviews: queue, batcher, rate limiter 33 Predict the output const b = createBatcher(batch => console.log('send', batch), { size: 3, wait: 50 }); P0 · Must know P0 · Must know Not answered yet
34 Predict the output const allow = createRateLimiter(2, 1000); // 2 calls per second P0 · Must know P0 · Must know Not answered yet
Stage 3 Browser platformLoading scripts: async, defer and modules 35 Predict the output <script defer src="a.js"></script> <!-- logs 'a' --> P1 · High P1 · High Not answered yet
DOM events and event delegation 36 Predict the output outer.addEventListener('click', () => console.log('outer bubble')); P1 · High P1 · High Not answered yet
37 Quick check In the example above, the button's listener calls event.stopPropagation(). What prints now? P1 · High P1 · High Not answered yet
Storing data in the browser: cookies and storage 38 Quick check localStorage.setItem('user', { name: 'Asha' }) then localStorage.getItem('user'). What do you get? P1 · High P1 · High Not answered yet
Networking: HTTP, caching, CORS and real-time data 39 Predict the output fetch('/missing-page') P1 · High P1 · High Not answered yet
Stage 4 Quality at scalePerformance and Core Web Vitals 40 Quick check A news page's headline image appears after 4.5 seconds. Which metric is failing, and what are two fixes? P0 · Must know P0 · Must know Not answered yet
41 Quick check A button click takes 600 ms before anything changes on screen. Which metric, and what do you check first? P0 · Must know P0 · Must know Not answered yet
42 Quick check While the page loads, the text jumps down when an ad appears above it. Which metric, and the fix? P0 · Must know P0 · Must know Not answered yet
Accessibility 43 Quick check A custom dropdown is built from <div> elements. A keyboard user presses Tab. What happens? P1 · High P1 · High Not answered yet
Frontend security 44 Quick check Does setting up CORS protect your site against CSRF? P1 · High P1 · High Not answered yet
45 Quick check Can you hide an API secret key inside your frontend JavaScript bundle? P1 · High P1 · High Not answered yet
Stage 5 Building UIsHTML and CSS essentials 46 Predict the output #msg { color: red; } P1 · High P1 · High Not answered yet
47 Predict the output .box { width: 200px; padding: 20px; border: 5px solid; } P1 · High P1 · High Not answered yet
48 Quick check An element has z-index: 9999 but still appears behind another element with z-index: 1. Why? P1 · High P1 · High Not answered yet
React in depth 49 Predict the output function Counter() { P1 · High P1 · High Not answered yet
50 Predict the output function App() { P1 · High P1 · High Not answered yet
51 Predict the output function Timer() { P1 · High P1 · High Not answered yet
52 Quick check A list renders items.map((item, i) => <Row key={i} />), and each row has a text input. You delete the first item. What goes wrong? P1 · High P1 · High Not answered yet