P
prepair.app
Start interview →
EnglishУкраїнськаРусский
🟨

Junior JavaScriptJavaScript interview questions

Junior · no experience / under 1 year

JavaScript interviews concentrate on a small number of things the language does differently from everything else: closures, `this`, prototypes and the event loop. Get those right and most other questions follow. Below are the ones asked most often, each with a model answer. Junior: core theory, definitions, and simple practical cases.

Topics to prepare

Types and coercion
Closures and scope
`this` and prototypes
The event loop and async
Promises and async/await
DOM, events and the browser

7 Junior-level questions with answers

1

What is the difference between primitives and objects?

Answer

Primitives — strings, numbers, booleans, null, undefined, symbols, bigints — are copied by value. Objects, including arrays and functions, are copied by reference, so two variables can point at the same thing and changing it through one is visible through the other. Almost every 'why did my array change' bug is this.

2

What is the difference between `var`, `let` and `const`?

Answer

var is scoped to the function and can be redeclared; let and const are scoped to the block. const means the binding cannot be reassigned — the object it points at can still be mutated. Use const by default and let when you genuinely reassign.

3

What is the difference between `null` and `undefined`?

Answer

undefined means a value was never assigned — a declared variable, a missing argument, a property that does not exist. null is an explicit 'nothing', assigned deliberately. typeof undefined is 'undefined', typeof null is 'object', and null == undefined is true while null === undefined is false.

4

How do you check that a value is an array, and that it is `NaN`?

Answer

Array.isArray(x) for the array, because typeof returns 'object' for both arrays and plain objects. For NaN, use Number.isNaN(x) — the old global isNaN coerces first, so isNaN('hello') is true even though a string is not a number. NaN is the only value not equal to itself, which is how the check works internally.

5

What is hoisting?

Answer

Declarations are processed before the code runs. A function declaration is fully hoisted and callable before its line; a var is hoisted as undefined; let and const are hoisted but unusable until the declaration — the temporal dead zone — so reading them early throws a ReferenceError.

6

What is the difference between `map`, `filter`, `reduce` and `forEach`?

Answer

map returns a new array of the same length with each item transformed. filter returns a shorter array of the items that passed a test. reduce folds the array into a single value. forEach returns nothing and exists only for side effects — using map when you ignore the result builds an array for nothing.

7

What is event bubbling, and how do you stop it?

Answer

A fired event runs on the target and then travels up through its ancestors, which is what makes event delegation possible — one listener on a list instead of one per item. event.stopPropagation() stops the travel; event.preventDefault() cancels the browser's default action, such as a form submitting or a link navigating. They are different things and are often confused.

🦎

Reading answers is not enough

In a real interview you speak under pressure. Cam asks these same questions, scores every answer, and shows exactly what to fix.

Practice a Junior JavaScript interview →
Free · 3 interviews per month

Other levels — JavaScript

Middle JavaScriptSenior JavaScriptAll JavaScript questions

Other specializations

🔍Junior Manual QA🤖Junior QA AutomationJunior Java Backend🐍Junior Python Backend🐘Junior PHP Backend🦫Junior Go Backend🟢Junior Node.js Backend💎Junior Ruby on Rails🔷Junior C++⚛️Junior React Frontend