Skip to main content
Back to blog// interview prep

The JavaScript Beginner Interview

A junior JavaScript interview isn't a vocabulary test. It's 'here's a snippet, tell me what it prints and why.' Here are the questions that actually come up, attempt each one, then reveal a full answer.

NK

Nicanor Korir

Author

July 15, 2026
14 min read
JavaScriptInterviewBeginnerCareerFrontendWeb Development

I've sat on both sides of the junior JavaScript interview, sweating through them early in my career, and now running them. And the single biggest misconception I see is this: candidates prepare like it's a vocabulary test. They memorise "a closure is a function inside a function" and hope the interviewer asks for the definition.

They almost never do.

What actually happens is: the interviewer pastes a five-line snippet and says "what does this print, and why?" They're not checking whether you memorised a sentence. They're watching how you reason about the language out loud, can you trace scope, predict coercion, and explain the async model without hand-waving.

This article is built to train exactly that. Below are the questions that genuinely come up in junior interviews, grouped by topic. Each one is an interactive card: read it, try to answer out loud first, then reveal the full answer. That "attempt before you peek" habit is the whole point, it's the difference between recognising an answer and being able to produce one under pressure.

When you're ready to drill these like flashcards against a timer, the interactive practice hub turns this whole series into an exam room.

What a junior JavaScript interview is really testing

Before the questions, the frame. A beginner round, usually a 30-45 minute call with a recruiter or an engineer, is screening for four things:

  • Core language fundamentals, types, coercion, scope, hoisting.
  • Whether you can predict what a snippet prints and explain why, not just what.
  • Comfort with everyday tools, array methods, the DOM, events, Promises.
  • Communication, thinking out loud, and admitting what you don't know cleanly instead of bluffing.

Two habits separate strong juniors from the rest: they narrate their reasoning instead of guessing one word and going quiet, and when they hit something they don't know, they say "I'm not sure, here's how I'd find out," which reads far better than a confident wrong answer.

Types & coercion

This is where the classic "gotcha" snippets live. Interviewers love them because coercion rules are where guessing falls apart and real understanding shows.

Q1
Types★★Phone screen

What's the difference between null and undefined? And what does typeof null return?

  • #null
  • #undefined
  • #typeof
Q2
Operators & coercion★★Phone screen

What's the difference between == and ===? What will this log?

JavaScript
javascript
1
2
3
4
5
  • #equality
  • #coercion
Q3
Operators & coercion★★Phone screen

Which values are falsy in JavaScript? And what's the difference between || and ?? for defaults?

  • #truthy
  • #falsy
  • #short-circuit
Q4
Operators & coercion★★Live coding

What does each line print?

JavaScript
javascript
1
2
3
4
5
  • #coercion
  • #operators

Scope, hoisting & declarations

If types are the most common gotcha, scope is the most common concept. Nearly every junior interview probes whether you understand var vs let/const and what hoisting really does.

Q5
Scope & declarations★★Phone screen

What's the difference between var, let, and const? When would you reach for each?

  • #var
  • #let
  • #const
  • #scope
Q6
Hoisting★★Live coding

What does this print, and why?

JavaScript
javascript
1
2
3
4
5
6
7
8
  • #hoisting
  • #scope
Q7
Closures★★Technical screen

What is a closure? Give a simple, practical example of why you'd want one.

  • #closures
  • #scope

Functions, this & modern syntax

Arrow functions and this trip up a lot of juniors, because the behaviour depends on how a function is called, not where it's written. Destructuring and spread/rest are the ES6 features you'll use every day, so expect them too.

Q8
this★★Live coding

What is this in JavaScript? Why do people use arrow functions for callbacks?

  • #this
  • #arrow-functions
Q9
ES6 syntax★★Live coding

Explain destructuring, and the difference between the spread and rest operators (both ...).

  • #destructuring
  • #spread
  • #rest

Values, references & arrays

The moment your code touches objects and arrays, the value-vs-reference distinction starts causing bugs. Interviewers test it with a small mutation snippet, then check that you know your array methods.

Q10
Types★★Live coding

What does this print, and why?

JavaScript
javascript
1
2
3
4
5
6
7
8
  • #reference
  • #value
  • #mutation
Q11
Arrays★★Live coding

Which common array methods mutate the original array, and which return a new one? Why does it matter?

  • #arrays
  • #mutation
  • #methods
Q12
Array methods★★Live coding

Given an array of numbers, use array methods to get the sum of the squares of the even numbers.

JavaScript
javascript
1
2
  • #map
  • #filter
  • #reduce

The DOM & events

For any frontend-leaning role, expect at least one DOM question. The two that come up most: how you select elements, and how event bubbling enables delegation.

Q13
DOM & events★★Technical screen

How do you select elements in the DOM, and what's the difference between querySelectorAll and getElementsByClassName?

  • #dom
  • #selectors
Q14
DOM & events★★Technical screen

What is event bubbling, and what is event delegation? Why is delegation useful?

  • #events
  • #delegation
  • #bubbling
Q15
Browser★★Technical screen

What's the difference between <script>, <script async>, and <script defer>?

  • #html
  • #performance
  • #loading

Async foundations

You won't get grilled on the event loop at this level, that's the intermediate round, but you will be asked how single-threaded JavaScript handles slow work without freezing, and to show basic comfort with Promises and async/await.

Q16
Async★★Technical screen

JavaScript is single-threaded. So how does it do things like network requests without freezing the page?

  • #async
  • #promises
  • #callbacks
Q17
Async★★Live coding

What is a Promise? Rewrite this callback code with async/await and handle errors.

JavaScript
javascript
1
2
3
4
5
6
7
  • #promises
  • #async-await

How to prepare (in the two weeks before)

You don't need months. For a junior role, 2-3 focused weeks covering the topics above is enough. What actually moves the needle:

  • Run the snippets yourself. Don't just read the answers, open a console, type each snippet, predict the output, then check. The prediction step is where learning happens.
  • Explain out loud, to a rubber duck or a friend. If you can't say why 0 == '' is true in a sentence, you don't know it yet.
  • Build one small thing that touches the DOM, events, and a fetch. Interviewers love asking "walk me through something you built."

The green flags interviewers are quietly scoring

  • You narrate your reasoning instead of blurting a single word.
  • You reach for const, ===, and array methods by instinct.
  • You say "I'm not sure, here's how I'd figure it out" rather than bluffing.

The red flags that sink candidates

  • Reciting a memorised definition but unable to apply it to a snippet.
  • Silence, the interviewer can't tell how you think, so they assume the worst.
  • Confusing null/undefined or ==/=== under light pressure.

Where to go next

Nail these and you're ready for the intermediate JavaScript interview, where the questions shift from "what prints" to "implement debounce" and "predict the microtask order." When you're ready for the deep end, the advanced / principal guide covers system design and performance at scale.

And to drill everything in this series as timed flashcards with progress tracking, head to the interview practice hub. Attempt, reveal, self-grade, repeat, until the answers are muscle memory.

Stay in the Loop

Get occasional updates on AI engineering, robotics projects, and lessons from building startups. No spam, unsubscribe anytime.