LearnThatStack Ace your next interview
Frontend Development

JavaScript.

Start free Change topic Change
Practice · Questions

All questions

Showing of 130
Beginner 29
01

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

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
  • var: Function-scoped, can be redeclared and updated, hoisted with undefined
  • let: Block-scoped, can be updated but not redeclared, hoisted but not initialized
  • const: Block-scoped, cannot be updated or redeclared, must be initialized at declaration
var a = 1;     // Function scoped
let b = 2;     // Block scoped
const c = 3;   // Block scoped, immutable binding
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

02

What is hoisting in JavaScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Hoisting is JavaScript's behavior of moving variable and function declarations to the top of their scope during compilation. Variables declared with var are hoisted and initialized with undefined, while let and const are hoisted but not initialized (temporal dead zone).

console.log(x); // undefined (not error)
var x = 5;
console.log(y); // ReferenceError
let y = 10;
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

03

Explain the concept of "use strict" in JavaScript

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

"use strict" enables strict mode, which catches common coding mistakes and prevents certain actions. It makes JavaScript more secure and optimized by:

  • Preventing use of undeclared variables
  • Disallowing duplicate parameter names
  • Making this undefined in functions (not global object)
  • Preventing deletion of variables, functions, or arguments
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

04

What are the different ways to declare a function in JavaScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
// Function declaration
function myFunction() { }
// Function expression
const myFunction = function() { };
// Arrow function
const myFunction = () => { };
// Function constructor (rarely used)
const myFunction = new Function('return 1');
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

05

What are the primitive data types in JavaScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

JavaScript has 7 primitive data types:

  1. Number: Integers and floating-point numbers
  2. String: Text data
  3. Boolean: true or false
  4. Undefined: Variable declared but not assigned
  5. Null: Intentional absence of value
  6. Symbol: Unique identifier (ES6)
  7. BigInt: Large integers beyond Number.MAX_SAFE_INTEGER (ES2020)
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

06

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

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
  • undefined: Variable has been declared but not assigned a value, or function parameter not provided
  • null: Intentional assignment representing "no value" or "empty"
let a; // undefined
let b = null; // null
typeof undefined; // "undefined"
typeof null;      // "object" (legacy quirk)
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

07

How do you check the type of a variable in JavaScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
typeof variable;           // Returns string representation
Array.isArray(variable);   // Check if array
variable instanceof Constructor; // Check instance type
Object.prototype.toString.call(variable); // Most reliable method
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

08

Explain the difference between `==` and `===`

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
  • == (loose equality): Performs type coercion before comparison
  • === (strict equality): Compares both value and type without coercion
5 == "5";    // true (coercion)
5 === "5";   // false (different types)
null == undefined;  // true
null === undefined; // false
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

09

How do you create objects in JavaScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
// Object literal
const obj1 = { name: "John", age: 30 };
// Object constructor
const obj2 = new Object();
obj2.name = "John";
// Object.create()
const obj3 = Object.create(null);
// Constructor function
function Person(name) { this.name = name; }
const obj4 = new Person("John");
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

10

What is the difference between dot notation and bracket notation?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Dot notation: Used with valid identifiers
Bracket notation: Used with dynamic keys, spaces, or special characters

const obj = { name: "John", "full name": "John Doe" };
obj.name;           // Dot notation
obj["full name"];   // Bracket notation
obj[variable];      // Dynamic access
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

11

What is scope in JavaScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

Scope determines the accessibility of variables and functions in different parts of code. JavaScript has:

  • Global scope: Variables accessible everywhere
  • Function scope: Variables accessible within function
  • Block scope: Variables accessible within block (let/const)
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

12

What is the difference between global, function, and block scope?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
  • Global scope: Variables declared outside any function/block
  • Function scope: Variables declared inside a function (var, parameters)
  • Block scope: Variables declared inside {} blocks (let, const)
var globalVar = "global";
function example() {
  var functionScoped = "function";
  if (true) {
    let blockScoped = "block";
    const alsoBlock = "block";
  }
}
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

13

What is the DOM?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

The Document Object Model (DOM) is a programming interface for HTML documents. It represents the page structure as a tree of objects that can be manipulated with JavaScript.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

14

How do you select elements from the DOM?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
// By ID
document.getElementById('myId');
// By class
document.getElementsByClassName('myClass');
document.querySelector('.myClass');
document.querySelectorAll('.myClass');
// By tag
document.getElementsByTagName('div');
// By CSS selector
document.querySelector('#myId .myClass');
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

15

What is the difference between `innerHTML`, `textContent`, and `innerText`?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
  • innerHTML: Gets/sets HTML content including tags
  • textContent: Gets/sets text content, ignores styling
  • innerText: Gets/sets visible text content, respects styling
element.innerHTML = '<b>Bold</b>';    // Renders as bold
element.textContent = '<b>Bold</b>';  // Shows literal text
element.innerText = 'Visible text';   // Respects CSS display
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

16

How do you create and append elements to the DOM?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
// Create element
const div = document.createElement('div');
div.textContent = 'Hello';
div.className = 'my-class';
// Append to DOM
document.body.appendChild(div);
// or
document.body.append(div);
// or
document.body.insertAdjacentElement('beforeend', div);
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

17

What are the different ways to handle events in JavaScript?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
// HTML attribute
<button onclick="handleClick()">Click</button>
// DOM property
button.onclick = function() { };
// addEventListener (recommended)
button.addEventListener('click', function() { });
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

18

How do you prevent default behavior and stop event propagation?

Part of Pro
19

What are template literals?

Part of Pro
20

What are default parameters?

Part of Pro
21

How do you handle errors in JavaScript?

Part of Pro
22

What is JSON and how do you work with it?

Part of Pro
23

What is localStorage and sessionStorage?

Part of Pro
24

What are cookies in JavaScript?

Part of Pro
25

What is the difference between `undefined` and `not defined`?

Part of Pro
26

What are falsy values in JavaScript?

Part of Pro
27

What is the ternary operator?

Part of Pro
28

What is the difference between forEach and map?

Part of Pro
29

What is the difference between slice and splice?

Part of Pro
Intermediate 78
30

What is the comma operator?

Part of Pro
31

What are array methods in JavaScript? Explain map, filter, and reduce

Part of Pro
32

What is destructuring assignment?

Part of Pro
33

What is the spread operator?

Part of Pro
34

What is the rest parameter?

Part of Pro
35

What is the nullish coalescing operator?

Part of Pro
36

What is optional chaining?

Part of Pro
37

What are the different types of errors in JavaScript?

Part of Pro
38

What is type coercion in JavaScript?

Part of Pro
39

What is the difference between function declarations and function expressions?

Part of Pro
40

What are arrow functions and how do they differ from regular functions?

Part of Pro
41

What are higher-order functions?

Part of Pro
42

What is the `arguments` object and what are its limitations?

Part of Pro
43

How do you copy objects in JavaScript?

Part of Pro
44

What is array destructuring?

Part of Pro
45

What is a closure in JavaScript?

Part of Pro
46

Explain lexical scoping in JavaScript?

Part of Pro
47

What is the temporal dead zone?

Part of Pro
48

What is a prototype in JavaScript?

Part of Pro
49

What is the prototype chain?

Part of Pro
50

What is the difference between `__proto__` and `prototype`?

Part of Pro
51

How does prototypal inheritance work?

Part of Pro
52

What is the `new` operator and how does it work?

Part of Pro
53

What are callbacks and what is callback hell?

Part of Pro
54

What are Promises in JavaScript?

Part of Pro
55

What is the difference between `Promise.all()` and `Promise.allSettled()`?

Part of Pro
56

What is async/await?

Part of Pro
57

What is event delegation?

Part of Pro
58

What is event bubbling and event capturing?

Part of Pro
59

What is the difference between `target` and `currentTarget` in events?

Part of Pro
60

What are classes in JavaScript?

Part of Pro
61

What are symbols in JavaScript?

Part of Pro
62

What are Maps and Sets?

Part of Pro
63

How do you create custom errors?

Part of Pro
64

How do you handle errors in async/await?

Part of Pro
65

What is debouncing and throttling?

Part of Pro
66

What is memoization?

Part of Pro
67

What is lazy loading?

Part of Pro
68

What are some JavaScript performance best practices?

Part of Pro
69

What is the difference between `call`, `apply`, and `bind`?

Part of Pro
70

What is the module system in JavaScript?

Part of Pro
71

What is tree shaking?

Part of Pro
72

What is the difference between CommonJS and ES6 modules?

Part of Pro
73

What is the Intersection Observer API?

Part of Pro
74

What is `requestAnimationFrame`?

Part of Pro
75

What is the Fetch API?

Part of Pro
76

What is CORS?

Part of Pro
77

What is the difference between localStorage, sessionStorage, and cookies?

Part of Pro
78

What is a polyfill?

Part of Pro
79

What is transpilation?

Part of Pro
80

What is implicit type conversion?

Part of Pro
81

What is the difference between `for...in` and `for...of`?

Part of Pro
82

What is short-circuit evaluation?

Part of Pro
83

What is BigInt?

Part of Pro
84

What is the `with` statement and why should you avoid it?

Part of Pro
85

What is memory management in JavaScript?

Part of Pro
86

What are pure functions?

Part of Pro
87

What is immutability in JavaScript?

Part of Pro
88

What is the difference between deep and shallow equality?

Part of Pro
89

What is the difference between `Object.freeze()`, `Object.seal()`, and `Object.preventExtensions()`?

Part of Pro
90

What is the difference between `Object.create()` and constructor functions?

Part of Pro
91

What is method chaining and how do you implement it?

Part of Pro
92

What is the call stack?

Part of Pro
93

What is stack overflow in JavaScript?

Part of Pro
94

What are the different ways to handle asynchronous operations?

Part of Pro
95

How does the this keyword work in JavaScript?

Part of Pro
96

What is the difference between async and defer on a script tag?

Part of Pro
97

What is an IIFE and why would you use one?

Part of Pro
98

What is the difference between an attribute and a property in the DOM?

Part of Pro
99

How do you cancel a fetch request with AbortController?

Part of Pro
100

What are getters and setters in JavaScript?

Part of Pro
101

Why is extending built-in JavaScript objects not a good idea?

Part of Pro
102

What are property flags and descriptors in JavaScript?

Part of Pro
103

What is the difference between the load and DOMContentLoaded events?

Part of Pro
104

Is JavaScript pass by value or pass by reference?

Part of Pro
105

Why is 0.1 + 0.2 not equal to 0.3 in JavaScript?

Part of Pro
106

What is the difference between Promise.race() and Promise.any()?

Part of Pro
107

Why does setTimeout in a var loop log the same value every time?

Part of Pro
Expert 23
108

What is functional programming in JavaScript?

Part of Pro
109

What are template tagged functions?

Part of Pro
110

Explain the concept of currying in JavaScript

Part of Pro
111

What is function composition?

Part of Pro
112

What is the Observer pattern in JavaScript?

Part of Pro
113

What is the Module pattern?

Part of Pro
114

What is the Singleton pattern in JavaScript?

Part of Pro
115

What is the Factory pattern?

Part of Pro
116

What are iterators and iterables?

Part of Pro
117

What are commonly used JavaScript design patterns?

Part of Pro
118

What are generators in JavaScript?

Part of Pro
119

What are dynamic imports in JavaScript?

Part of Pro
120

What is the MutationObserver API?

Part of Pro
121

What are Web Workers?

Part of Pro
122

What are private class fields in JavaScript?

Part of Pro
123

What is recursion and how do you optimize it?

Part of Pro
124

What is a WeakMap and WeakSet?

Part of Pro
125

What is the event loop in JavaScript?

Part of Pro
126

What is the difference between microtasks and macrotasks?

Part of Pro
127

What is a Proxy in JavaScript?

Part of Pro
128

What is Reflect in JavaScript?

Part of Pro
129

What is Service Worker?

Part of Pro
130

What is the execution context in JavaScript?

Part of Pro

No matches

Try a different filter or search term.

Know someone prepping for JavaScript? Send them this set.
Pro · $10/mo

113 of 130 JavaScript answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime

Change topic

Pick a different technology or stack. Your current topic stays put until you choose a new one.

Technologies
No technologies match “”.
Cross-cutting topics
No topics match “”.
By role
Stacks & frameworks

MEAN

MongoDB, Express, Angular, Node.js

MERN

MongoDB, Express, React, Node.js

LAMP

Linux, Apache, MySQL, PHP

Django

Python Full-Stack Development

Ruby on Rails

Convention over Configuration

Serverless on AWS

Serverless Architecture on AWS

Flutter Mobile

Flutter Cross-Platform Mobile Development

Spring Boot

Enterprise Java Development

.NET

Microsoft Ecosystem

Vue

Vue.js, Vite, TypeScript, Tailwind, Node.js

Go Backend

Golang, gRPC, PostgreSQL, Redis, RabbitMQ

FastAPI

Python, FastAPI, SQLAlchemy, PostgreSQL

React Native

React, TypeScript, Redux, Firebase

iOS Native

Swift, SwiftUI, UIKit, Firebase

Android Native

Java, Jetpack Compose, Firebase

DevOps / Platform

Docker, Kubernetes, Terraform, CI/CD

AI Engineer

LLMs, RAG, Agents, Evals

AI-Powered Developer

Claude Code, Copilot, Agentic Workflows

Core SWE Interview Prep

Data structures, algorithms, OS, concurrency, networking, git