Skip to main content
JavaScript Interview Questions Predict Output P1 Hard

When map supplies more than one argument

Predict the line and identify which argument causes the surprise.

Official Reference

Code Snippet

const parts = ["11", "11", "11", "11"];
console.log(parts.map(parseInt).join(" "));
console.log(parts.map(part => parseInt(part, 10)).join(" "));

Expected Output & Explanation

11 NaN 3 4
11 11 11 11

map passes (value, index, array). parseInt uses the index as its radix: 0 triggers radix inference, 1 is invalid, and the remaining values use base 2 and base 3.

Module Context & References

JavaScript · Language output drills Trace closures, receivers, prototypes, coercion and array edge cases
Personal Notes · Markdown

Technologies & Interview Topics Covered

Switch between short-term interview tracks and long-term 80/20 engineering depth to practice JavaScript internals, React rendering and hooks, timed frontend machine coding UI challenges, MeetaPro FG300, Blind 75 & NeetCode 150 DSA patterns, Python & FastAPI APIs, PostgreSQL query optimization & MVCC, Redis caching, Applied AI RAG pipelines & evaluations, and distributed system design.