← All Questions

JavaScript Interview Questions

Interview questions covering javascript fundamentals.

01

JavaScript call, apply, bind methods

Learn call apply bind in JavaScript with clear examples, mental models, and common interview questions about the this keyword, context, and bind polyfills.

javascript
02

What is the Closure in JavaScript?

What is a closure in JavaScript? Learn how functions remember their lexical scope, see practical examples, and review common interview questions about closures.

javascript
03

Difference between cookie, sessionStorage, and localStorage

Compare cookies, sessionStorage and localStorage: lifetime, size limits, server access and security, and learn which browser storage to use for each case.

javascript
04

What are the data types in JavaScript?

What are the data types in JavaScript? Review primitives and objects, typeof quirks, type coercion, and the differences interviewers commonly ask about.

javascript
05

JavaScript Event Loop

Understand the JavaScript event loop: how the call stack, task queue and microtask queue work together to run asynchronous code, with clear examples.

javascript
06

Events: bubbling, capturing, propagation, delegation

Learn JavaScript events: bubbling, capturing, propagation and event delegation. See how events travel through the DOM and how to handle them efficiently.

javascript
07

Generators and Iterators in JavaScript

Learn generators and iterators in JavaScript: the iterator protocol, yield and function*, lazy sequences and practical use cases, with examples and pitfalls.

javascript
08

Higher Order Functions

What are higher order functions in JavaScript? Learn how functions that take or return other functions work, with map, filter, reduce and custom examples.

javascript
09

Hoisting in JavaScript

Learn how hoisting works in JavaScript for var, let, const, functions and classes, what the temporal dead zone is, and the questions often asked in interviews.

javascript
10

How does a browser render a webpage?

How does a browser render a webpage? Walk through parsing HTML and CSS, the DOM and CSSOM, layout, paint and compositing, and what triggers reflow and repaint.

javascript
11

Javascript Modules: AMD, CommonJS, ES6 Modules

Compare JavaScript module systems: AMD, CommonJS and ES modules. Learn their syntax, how loading differs, and which one to use in browsers and in Node.js.

javascript
12

Memory Management and Garbage Collection in Javascript

Learn JavaScript memory management and garbage collection: how memory is allocated, how mark-and-sweep works, and the common causes of memory leaks.

javascript
13

Pass by value and reference

Is JavaScript pass by value or pass by reference? Learn how primitives and objects are passed to functions, with examples and common interview pitfalls.

javascript
14

Understanding Promise in JavaScript

Understand JavaScript promises: states, promise chaining, error handling, and the differences between Promise.all, allSettled, race and any, with examples.

javascript
15

Prototypes

Learn JavaScript prototypes and the prototype chain: how inheritance works, __proto__ versus prototype, Object.create and classes, with interview examples.

javascript
16

Pure and Impure functions

What are pure and impure functions in JavaScript? Learn what side effects are, why pure functions are easier to test, and how to refactor impure code.

javascript
17

Scope, Lexical Environment, Execution Context

Learn JavaScript scope, lexical environment and execution context: how variables are resolved, how the scope chain works, and how closures relate to them.

javascript
18

Difference between script, script-async, script-defer

Learn the difference between script, async and defer in HTML: how each affects HTML parsing and script execution order, and which to use for page speed.

javascript
19

this keyword in javascript

How does the this keyword work in JavaScript? Learn the binding rules for default, implicit, explicit and arrow functions, with examples and interview pitfalls.

javascript
20

What happens when you type URL in browser

What happens when you type a URL in the browser? Follow the steps from DNS lookup and TCP and TLS to the HTTP request, server response and page rendering.

javascript
21

var, let, and const

Learn the differences between var, let and const in JavaScript: scope, hoisting, the temporal dead zone and reassignment, plus which one to use and why.

javascript