JavaScript Interview Questions Freshers Actually Get Asked (With Answers)
JavaScript interview questions freshers face: var/let/const, closures, this, event loop, promises, prototypes and array methods - with the answers panels listen for.

The JavaScript interview questions freshers actually face cluster around eight themes: var/let/const and hoisting, == vs ===, closures, this binding, event loop and promises, prototypal inheritance, array methods (map/filter/reduce), and async/await with error handling. If you can explain each of these with a small code example and predict its output, you are better prepared than most applicants for service companies (TCS, Infosys, Wipro, Accenture) and product startups alike. This guide covers the questions in the order interviewers usually ask them, with the answers they are listening for.
Core language questions (asked in almost every round)
1. What is the difference between var, let and const? var is function-scoped and hoisted with an initial value of undefined; let and const are block-scoped and sit in the temporal dead zone until their line executes. const prevents reassignment of the binding, not mutation of the object it points to. Interviewers often follow up with: "What prints?" - console.log(a); var a = 5; prints undefined, while the let version throws a ReferenceError.
2. == vs ===? == coerces types before comparing ("5" == 5 is true); === compares type and value without coercion ("5" === 5 is false). Always use === unless you are deliberately checking null/undefined together with == null.
3. What is hoisting? Declarations (not initialisations) are moved to the top of their scope during compilation. Function declarations hoist fully; function expressions and arrow functions assigned to variables do not.
4. Explain == null checks and falsy values. The falsy list is short and exact: false, 0, -0, 0n, "", null, undefined, NaN. Everything else - including "0", [] and {} - is truthy.
Closures, scope and this
5. What is a closure? A function that remembers variables from the scope where it was created, even after that scope has finished executing. The classic trap: for (var i = 0; i < 3; i++) setTimeout(() => console.log(i), 0) prints 3, 3, 3 because all three callbacks share one var binding; switching to let gives each iteration its own binding and prints 0, 1, 2.
6. How does this work? this is set by the call site: a plain function call gives undefined in strict mode (the global object otherwise), a method call gives the object before the dot, call/apply/bind set it explicitly, and arrow functions inherit this from the enclosing scope. The standard follow-up: extracting a method into a variable loses the object binding.
Async JavaScript and the event loop
7. Explain the event loop. JavaScript runs one call stack; Web APIs handle timers, fetch and DOM events, then push their callbacks to queues. The event loop moves callbacks to the stack only when it is empty. Microtasks (promise .then, queueMicrotask) run before the next macrotask (setTimeout, I/O) - so setTimeout(fn, 0) still prints after Promise.resolve().then(fn).
8. Promises vs async/await? async/await is syntax over promises: await pauses the async function without blocking the thread, and errors surface through try/catch instead of .catch. Know Promise.all (fails fast on first rejection), Promise.allSettled (waits for everything), Promise.race, and Promise.any.
Objects, prototypes and arrays
9. What is prototypal inheritance? Objects delegate property lookups up their prototype chain. ES6 classes are syntax over this mechanism: class methods live on the prototype, and instanceof walks the chain. A common task: implement inheritance with Object.create and explain why child.prototype.constructor needs resetting.
10. map, filter, reduce - and when not to use them. map transforms each element 1:1, filter keeps matching elements, reduce folds the array into one value. Interviewers love asking for a reduce that re-implements map, or a pipeline like "from this array of employees, return total salary of engineers above 25" in one chain.
Rapid-fire questions service-company panels ask
- Difference between null and undefined (assigned absence vs never assigned)
- What is NaN and why does NaN !== NaN (IEEE 754 rule; use Number.isNaN)
- Shallow vs deep copy (spread/Object.assign share nested references; structuredClone for deep)
- Debounce vs throttle (trailing-edge collapse vs fixed-rate limiting) - often a live coding task
- Event delegation and bubbling (one listener on the parent, read event.target)
- localStorage vs sessionStorage vs cookies (capacity, lifetime, sent-to-server behaviour)
A worked example answer
Asked "what does this print?", walk the panel through it aloud instead of answering instantly: "b is declared with var so it hoists as undefined; the assignment happens inside the function..." Interviewers score the reasoning, not just the final value. Practise out loud on our interview question bank, which has follow-up variants for each of these themes, and pair this prep with our OOPS interview questions and SQL interview questions - fresher panels almost always mix all three.
Mistakes that cost offers
- Memorising outputs without the why. Panels change one keyword and the memorised answer collapses.
- Claiming "JavaScript is single-threaded so it can't do async." The runtime's event loop and Web APIs are exactly how it does async - say that.
- Not knowing array method edge cases. map on a sparse array skips holes; sort() without a comparator sorts as strings ([10, 9, 80] becomes [10, 80, 9]).
- Freezing on live coding. Debounce, a flatten function and a deep-equal check are the three most common freshers' tasks - write them by hand at least once before the interview.
Frequently asked questions
Are JavaScript interviews for freshers hard?
They are predictable rather than hard. Service companies stay on language basics and one small coding task; product startups add live coding and one event-loop question. Eight themes cover most of what either asks.
Should I learn TypeScript before interviews?
Get JavaScript fundamentals solid first - every TypeScript question still sits on top of them. Mentioning basic types and interfaces is a plus for product companies but rarely a deciding factor for freshers.
Which topics matter most for React roles?
Closures, this, array methods and promises - React interviewers test JavaScript through hooks behaviour (stale closures are the favourite trap), so the same fundamentals apply.
How many questions should I prepare?
Depth on thirty core questions beats shallow coverage of two hundred. For each, know the definition, a code example, and one follow-up variant.
Do service companies ask output-prediction questions?
Yes, constantly - hoisting, closures in loops and == coercion are the three most repeated in TCS, Infosys and Accenture fresher drives.





