Quick answer: What JavaScript questions do interviews ask freshers, and how should I answer?
- Language basics — let/const/var, scope, hoisting, types, == vs ===, truthiness.
- Functions — closures, this, arrow functions, call/apply/bind, higher-order functions.
- Async — callbacks, promises, async/await, the event loop and microtasks.
- Browser — DOM selection and updates, events, bubbling and delegation, fetch.
- Most used — JavaScript is the most-used language among professional developers (Stack Overflow, 2025).
Key takeaways
- Framework interviews still start with plain JavaScript — fundamentals decide the first round.
- Output-prediction questions on closures, this and the event loop are standard; practise explaining, not guessing.
- Small vanilla JavaScript projects build the skills frameworks hide.
- Async errors and race conditions separate prepared freshers from the rest.
- A verified fundamentals score is a quick signal for career-switchers without CS degrees.
Picture a front-end interview for freshers at a Noida product company. The first question isn't about React at all. The interviewer types five lines — a for loop with var, a setTimeout inside, and console.log(i) — and asks what prints. Most candidates say 0, 1, 2. It prints 3, 3, 3. The candidate who explains why (var is function-scoped, so every callback closes over the same variable; let creates a new binding per iteration) moves to the next round. JavaScript interviews for freshers are full of moments like this, and every one of them can be learned.

Why JavaScript fundamentals decide web interviews
JavaScript is the most-used language among professional developers in Stack Overflow's 2025 survey, alongside HTML and CSS.5 Every front-end framework — React, Angular, Vue — and Node.js on the server is JavaScript underneath, so interviewers test the language first. Candidates who know a framework but not closures, this or the event loop rarely pass the first technical round.
The jobs these fundamentals open are plentiful in India: AmbitionBox lists about 68,600 front-end developer salaries alone, with typical pay of ₹6.1–6.7 lakh in October 2026.6
- JavaScript's rank among most-used languages by professional developers (Stack Overflow, 2025)
- #1
- Typical front-end developer pay in India (AmbitionBox, Oct 2026)
- ₹6.1–6.7 lakh
- Front-end developer salaries on AmbitionBox
- ~68,600
- Where JavaScript fundamentals are tested
- 1st round
How JavaScript is tested
| Format | Example | What they check |
|---|---|---|
| Output prediction | "What does this print?" | Scope, closures, this, event loop |
| Concept questions | "Explain closures with an example." | Clear understanding |
| Small coding tasks | Debounce, flatten an array, deep clone | Problem-solving in JS |
| DOM tasks | Build a todo list or tabs without a framework | Browser fundamentals |
| Async tasks | Fetch with retries, run promises with a concurrency limit | Async correctness |
Table: How JavaScript is tested in interviews (editorial summary)
What a fundamentals test covers

Scope and hoisting
let and const are block-scoped; var is function-scoped and hoisted; the temporal dead zone.
Types and equality
Primitive vs reference types, == vs ===, truthy and falsy values, typeof quirks.
Functions and closures
Closures, higher-order functions, default and rest parameters.2
this
Method calls, plain calls, new, call/apply/bind, and arrow functions' lexical this.
Async
Callbacks, promises, async/await, error handling and the event loop.3
Modules and the DOM
ES modules, querySelector, events, bubbling and delegation, fetch.
MDN's JavaScript Guide is the best free reference,1 and the ECMAScript specification is the final word when behaviour is surprising.4
Worked example: debounce, explained
A favourite fresher task: "Write a debounce function."
function debounce(fn, delay) {
let timer;
return function (...args) {
clearTimeout(timer);
timer = setTimeout(() => fn.apply(this, args), delay);
};
}
const onSearch = debounce((q) => console.log("search", q), 300);
What to say: the returned function closes over timer, so every call shares it; each call cancels the previous timer, so fn runs only after 300 ms of quiet; apply preserves this and arguments. Then mention edge cases — a leading-edge option, cancelling, and why it's useful for search boxes and resize events.
JavaScript interview questions, with how to answer them
"What prints: for (var i = 0; i < 3; i++) setTimeout(() => console.log(i));"
3, 3, 3 — var is shared across iterations and the callbacks run after the loop ends. With let, it prints 0, 1, 2 because each iteration gets a new binding.
"Explain hoisting."
Declarations are processed before code runs: var declarations are hoisted and initialised to undefined; function declarations are hoisted fully; let and const are hoisted but not initialised (temporal dead zone).
"What's the output order of a setTimeout(0) and a resolved promise?"
The promise callback first — microtasks run before the next macrotask.
"Difference between map, forEach, filter and reduce?"
map returns a new array of transformed items; forEach just iterates; filter returns items that pass a test; reduce combines items into one value.
"How do you copy an object?"
Spread or Object.assign for shallow copies; structuredClone for deep copies of plain data.
"What is event delegation?"
Attaching one listener to a parent and using event.target to handle events from many children — efficient and works for elements added later.
"Why use async/await over .then()?"
It reads like synchronous code and makes try/catch error handling simpler; underneath it's still promises.
"What is a pure function?"
One that returns the same output for the same input and has no side effects — easier to test and reason about.
How JavaScript expectations have changed
| Period | What happened | What interviews tested |
|---|---|---|
| 2005–2011 | AJAX and jQuery era | DOM scripting, cross-browser quirks |
| 2012–2015 | Node.js, single-page apps | Closures, prototypes, callbacks |
| 2015–2019 | ES2015+: let/const, arrow functions, promises, classes, modules | Modern syntax, promises |
| 2020–2024 | async/await everywhere; TypeScript common | Async correctness, types |
| 2025–2027 | AI writes routine JS | Explaining and debugging code you didn't write |
Table: How JavaScript interview expectations have changed (editorial summary)
Practice tasks that build JavaScript skill
- Output drills — Fifty output-prediction snippets on scope, this and the event loop; explain each aloud.
- Utility functions — Write debounce, throttle, deep clone, flatten and a simple promise pool from scratch.
- A vanilla app — Build a filterable list with fetch, loading and error states, and event delegation — no framework.
- Async race — Build a search that ignores out-of-order responses using AbortController.
- Read the spec once — Look up one surprising behaviour in the ECMAScript specification.
Could you pass the JavaScript Fundamentals Certification today?
Hiring managers test judgement with scenarios like this one. Answer it before you open the explanation — the test has 10 of them, 10 minutes, 70% to pass.
What does typeof null return in JavaScript?
- "object"
- "null"
- "undefined"
- "number"
Show the answer
A. "object" — A long-standing quirk of the language; check for null explicitly.
- 01Language basics
- 02Async and the browser
Free, no sign-up. Pass and you become a JavaScript Fundamentals, with a credential ID employers can verify. Every answer is explained either way.
Where JavaScript takes your career
| Role (India) | Typical pay | How JavaScript is used |
|---|---|---|
| Front-end developer | ₹6.1–6.7 lakh | UI and browser logic |
| React developer | ₹5.7–6.3 lakh | Components and state |
| Node.js developer | ₹6.9–7.6 lakh | Server-side JavaScript |
| Full-stack developer | ₹9.2–10.2 lakh | Both sides of the stack |

Table: JavaScript-based roles and typical pay in India (AmbitionBox, October 2026; indicative)
A four-week plan

- Week 1: Language core — Scope, types, functions, closures, this.
- Week 2: Data and modules — Arrays, objects, destructuring, spread, ES modules.
- Week 3: Async and DOM — Promises, async/await, event loop, fetch, events.
- Week 4: Practice and proof — Output drills and small tasks; take the JavaScript Fundamentals Certification.
Next: the TypeScript test, the HTML and CSS test and React Developer Assessment; our guides on front-end and Node.js jobs show where they lead.
How JavaScript shows up at work
- Debugging async bugs — race conditions between API calls, stale state and unhandled promise rejections.
- Reading framework code — understanding what React, Angular or Vue does with your functions and closures.
- Performance work — avoiding unnecessary work on the main thread and in event handlers.
- Browser APIs — fetch, storage, events and observers used directly or through libraries.
- Code review — catching == comparisons, accidental mutation and this-binding mistakes.
- Utilities — writing small, well-tested helpers instead of pulling in large libraries.
More questions interviewers ask
"What is the difference between null and undefined?"
undefined means a variable was declared but not assigned (or a missing property); null is an intentional "no value". typeof null is "object" for historical reasons.
"What does the spread operator do?"
It expands arrays or objects into individual elements or properties — useful for copying, merging and passing arguments. Copies are shallow.
"What is a higher-order function?"
A function that takes or returns another function, such as map, filter or a debounce wrapper.
"How do you handle errors with async/await?"
Wrap awaits in try/catch, handle rejections close to where you can act on them, and use Promise.allSettled when partial failure is acceptable.
"What is the difference between call, apply and bind?"
call and apply invoke a function immediately with a chosen this (apply takes arguments as an array); bind returns a new function with this fixed for later.
Mistakes that cost candidates
- Guessing output instead of reasoning aloud.
- Confusing == and ===.
- Not knowing what this refers to.
- Ignoring promise errors.
- Only knowing a framework.
How we know
Technical references are MDN's JavaScript Guide (including closures and promises) and the ECMAScript specification; usage data from Stack Overflow's 2025 survey; pay from AmbitionBox (read October 2026). Test formats and the history table are editorial summaries. Science of Apps publishes the free certification linked here. Last reviewed October 2026.
Key terms, defined
- Closure — a function that keeps access to variables from where it was created.
- Hoisting — declarations being processed before code runs.
- Event loop — the mechanism that runs queued tasks when the call stack is empty.
- Promise — an object representing a value that will be available later.
- Event delegation — handling events from many children with one parent listener.
Frequently asked questions
What JavaScript topics should a fresher know?
Variables and scope (let, const, var), data types and equality, functions and closures, this and arrow functions, arrays and objects with their common methods, promises and async/await, the event loop, ES modules, and DOM manipulation with events. These come up in nearly every front-end and full-stack interview.
What is a closure in JavaScript?
A closure is a function that remembers the variables from the scope where it was created, even after that scope has finished running. Closures power data privacy, function factories and callbacks, and explain classic bugs like loops with var capturing the same variable.
What is the difference between == and ===?
=== compares value and type without conversion; == converts types before comparing, which produces surprising results such as 0 == '' being true. Use === by default.
How does this work in JavaScript?
this depends on how a function is called: the object before the dot for method calls, undefined in strict-mode plain calls, a new object with new, and an explicitly set value with call, apply or bind. Arrow functions don't have their own this; they use the surrounding scope's.
What is the event loop?
JavaScript runs on a single thread. The event loop runs queued work when the call stack is empty: first all microtasks (like promise callbacks), then the next macrotask (like a timer or event). This explains why a resolved promise's callback runs before a zero-delay setTimeout.
How do I prepare for a JavaScript interview in a month?
Spend the first two weeks on fundamentals with MDN and small exercises, the third on async and the DOM with a vanilla project, and the fourth on timed output questions and small coding tasks, explaining your reasoning aloud. Take a short verified test to find gaps.
Sources
- MDN Web Docs — JavaScript Guide
- MDN Web Docs — Closures
- MDN Web Docs — Using promises
- Ecma International — ECMAScript Language Specification (TC39)
- Stack Overflow — 2025 Developer Survey, Technology
- AmbitionBox — Front end Developer salaries in India (updated 24 Oct 2026)
- Checked October 28, 2026. Figures that change — fees, salaries, prices — are reviewed every six months; if something is out of date, tell us.
Certifications to take next
- 20 AI skills for software engineers — copy-paste prompts for this job, one tap into ChatGPT or Claude
- JavaScript Fundamentals Certification — the free 10-minute test on language basics, async and the browser
- How to get a front-end developer job — where these fundamentals lead
- TypeScript skills for developer jobs — the typed next step
- Free skill test · 15 minC# and .NET Development CertificationTests C# and modern .NET — types and nullable references, LINQ, async/await, dependency injection, ASP.NET Core APIs, Entity Framework Core and testing.
- Free skill test · 10 minPython Programming CertificationTests core Python — data types, control flow, functions, lists and dictionaries, comprehensions, exceptions, files, modules, virtual environments and PEP 8 style.
- Free skill test · 15 minNode.js Development CertificationTests Node.js — the event loop, async patterns, modules, npm and package security, building HTTP APIs, streams, error handling and running Node in production.
- Free skill test · 15 minFront-End Development CertificationTests modern front-end engineering — component architecture, state, performance and Core Web Vitals, accessibility, responsive layouts, testing and build tooling.
- Free skill test · 20 minData Structures and Algorithms CertificationTests core DSA for interviews and real work — Big-O, arrays, hash maps, stacks and queues, trees and graphs, sorting and searching, recursion and dynamic programming.
- Free skill test · 15 minTypeScript Fundamentals CertificationTests practical TypeScript — types and interfaces, unions and narrowing, generics, utility types, strict mode, the satisfies operator and typing real-world code.
Career guides for related roles
- Career guidesHow to get a front-end developer job in 2027: the skills, projects and interview rounds that decide itHow to get a front-end developer job in 2027: JavaScript, React, accessibility and performance skills employers test, the interview loop, pay and a plan.
- Career guidesHow to get a full-stack developer job in 2027: what "full stack" really means to employers, and how to prove itHow to get a full-stack developer job in 2027: front-end, back-end and deployment skills employers test, the interview loop, pay and a plan.
- Career guidesHow to get a Node.js developer job in 2027: the event loop, async patterns and the back-end skills employers testHow to get a Node.js developer job in 2027: the event loop, async patterns, APIs, security and testing skills employers test, pay and a plan.
- Career guidesNext.js developer jobs in 2027: the App Router, Server Components and caching skills employers testNext.js developer jobs in 2027: App Router, Server and Client Components, Server Actions, caching and SEO skills employers test, interview questions and pay.
- Career guidesHow to get a .NET developer job in 2027: modern C#, ASP.NET Core and the enterprise skills employers testHow to get a .NET developer job in 2027: modern C#, ASP.NET Core, EF Core, testing and Azure skills employers test, interview questions and pay.
- Career guidesHow to get a Java developer job in 2027: modern Java, Spring Boot and the interview rounds banks and product firms runHow to get a Java developer job in 2027: core and modern Java, Spring Boot, testing and concurrency skills employers test, interview questions, pay and a plan.
Get the ideas, not the noise.
Sign up with Google and we’ll send you short UX psychology tips by email — why people tap, stall and leave, and what to do about it. Unsubscribe anytime. Prefer something to keep? Get the free Laws of UX guide as a PDF.
You've read the playbook. Now prove it.
Take the free JavaScript Fundamentals Certification and earn JavaScript Fundamentals (SOA-JS). Free, test-based certifications graded on our server. Pass and you get a founder-signed certificate with a credential ID and QR code employers can verify.






