All questions
Showing of 130What is the difference between `let`, `var`, and `const`?
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:
Last attempt -
var: Function-scoped, can be redeclared and updated, hoisted withundefinedlet: Block-scoped, can be updated but not redeclared, hoisted but not initializedconst: 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
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 ↓
What is hoisting in JavaScript?
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:
Last attempt -
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;
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 ↓
Explain the concept of "use strict" in JavaScript
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:
Last attempt -
"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
thisundefined in functions (not global object) - Preventing deletion of variables, functions, or arguments
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 ↓
What are the different ways to declare a function in JavaScript?
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:
Last attempt -
// Function declaration
function myFunction() { }
// Function expression
const myFunction = function() { };
// Arrow function
const myFunction = () => { };
// Function constructor (rarely used)
const myFunction = new Function('return 1');
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 ↓
What are the primitive data types in JavaScript?
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:
Last attempt -
JavaScript has 7 primitive data types:
- Number: Integers and floating-point numbers
- String: Text data
- Boolean: true or false
- Undefined: Variable declared but not assigned
- Null: Intentional absence of value
- Symbol: Unique identifier (ES6)
- BigInt: Large integers beyond Number.MAX_SAFE_INTEGER (ES2020)
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 ↓
What is the difference between `null` and `undefined`?
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:
Last attempt -
undefined: Variable has been declared but not assigned a value, or function parameter not providednull: Intentional assignment representing "no value" or "empty"
let a; // undefined
let b = null; // null
typeof undefined; // "undefined"
typeof null; // "object" (legacy quirk)
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 ↓
How do you check the type of a variable in JavaScript?
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:
Last attempt -
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
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 ↓
Explain the difference between `==` and `===`
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:
Last attempt -
==(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
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 ↓
How do you create objects in JavaScript?
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:
Last attempt -
// 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");
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 ↓
What is the difference between dot notation and bracket notation?
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:
Last attempt -
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
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 ↓
What is scope in JavaScript?
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:
Last attempt -
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)
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 ↓
What is the difference between global, function, and block scope?
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:
Last attempt -
- 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";
}
}
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 ↓
What is the DOM?
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:
Last attempt -
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.
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 ↓
How do you select elements from the DOM?
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:
Last attempt -
// 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');
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 ↓
What is the difference between `innerHTML`, `textContent`, and `innerText`?
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:
Last attempt -
innerHTML: Gets/sets HTML content including tagstextContent: Gets/sets text content, ignores stylinginnerText: 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
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 ↓
How do you create and append elements to the DOM?
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:
Last attempt -
// 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);
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 ↓
What are the different ways to handle events in JavaScript?
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:
Last attempt -
// HTML attribute
<button onclick="handleClick()">Click</button>
// DOM property
button.onclick = function() { };
// addEventListener (recommended)
button.addEventListener('click', function() { });
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 ↓
How do you prevent default behavior and stop event propagation?
What are template literals?
What are default parameters?
How do you handle errors in JavaScript?
What is JSON and how do you work with it?
What is localStorage and sessionStorage?
What are cookies in JavaScript?
What is the difference between `undefined` and `not defined`?
What are falsy values in JavaScript?
What is the ternary operator?
What is the difference between forEach and map?
What is the difference between slice and splice?
What is the comma operator?
What are array methods in JavaScript? Explain map, filter, and reduce
What is destructuring assignment?
What is the spread operator?
What is the rest parameter?
What is the nullish coalescing operator?
What is optional chaining?
What are the different types of errors in JavaScript?
What is type coercion in JavaScript?
What is the difference between function declarations and function expressions?
What are arrow functions and how do they differ from regular functions?
What are higher-order functions?
What is the `arguments` object and what are its limitations?
How do you copy objects in JavaScript?
What is array destructuring?
What is a closure in JavaScript?
Explain lexical scoping in JavaScript?
What is the temporal dead zone?
What is a prototype in JavaScript?
What is the prototype chain?
What is the difference between `__proto__` and `prototype`?
How does prototypal inheritance work?
What is the `new` operator and how does it work?
What are callbacks and what is callback hell?
What are Promises in JavaScript?
What is the difference between `Promise.all()` and `Promise.allSettled()`?
What is async/await?
What is event delegation?
What is event bubbling and event capturing?
What is the difference between `target` and `currentTarget` in events?
What are classes in JavaScript?
What are symbols in JavaScript?
What are Maps and Sets?
How do you create custom errors?
How do you handle errors in async/await?
What is debouncing and throttling?
What is memoization?
What is lazy loading?
What are some JavaScript performance best practices?
What is the difference between `call`, `apply`, and `bind`?
What is the module system in JavaScript?
What is tree shaking?
What is the difference between CommonJS and ES6 modules?
What is the Intersection Observer API?
What is `requestAnimationFrame`?
What is the Fetch API?
What is CORS?
What is the difference between localStorage, sessionStorage, and cookies?
What is a polyfill?
What is transpilation?
What is implicit type conversion?
What is the difference between `for...in` and `for...of`?
What is short-circuit evaluation?
What is BigInt?
What is the `with` statement and why should you avoid it?
What is memory management in JavaScript?
What are pure functions?
What is immutability in JavaScript?
What is the difference between deep and shallow equality?
What is the difference between `Object.freeze()`, `Object.seal()`, and `Object.preventExtensions()`?
What is the difference between `Object.create()` and constructor functions?
What is method chaining and how do you implement it?
What is the call stack?
What is stack overflow in JavaScript?
What are the different ways to handle asynchronous operations?
How does the this keyword work in JavaScript?
What is the difference between async and defer on a script tag?
What is an IIFE and why would you use one?
What is the difference between an attribute and a property in the DOM?
How do you cancel a fetch request with AbortController?
What are getters and setters in JavaScript?
Why is extending built-in JavaScript objects not a good idea?
What are property flags and descriptors in JavaScript?
What is the difference between the load and DOMContentLoaded events?
Is JavaScript pass by value or pass by reference?
Why is 0.1 + 0.2 not equal to 0.3 in JavaScript?
What is the difference between Promise.race() and Promise.any()?
Why does setTimeout in a var loop log the same value every time?
What is functional programming in JavaScript?
What are template tagged functions?
Explain the concept of currying in JavaScript
What is function composition?
What is the Observer pattern in JavaScript?
What is the Module pattern?
What is the Singleton pattern in JavaScript?
What is the Factory pattern?
What are iterators and iterables?
What are commonly used JavaScript design patterns?
What are generators in JavaScript?
What are dynamic imports in JavaScript?
What is the MutationObserver API?
What are Web Workers?
What are private class fields in JavaScript?
What is recursion and how do you optimize it?
What is a WeakMap and WeakSet?
What is the event loop in JavaScript?
What is the difference between microtasks and macrotasks?
What is a Proxy in JavaScript?
What is Reflect in JavaScript?
What is Service Worker?
What is the execution context in JavaScript?
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
JavaScript cheatsheet
- Variables & types01
- Functions & scope02
- Objects & classes03
- Arrays, loops & syntax04
- Async & the event loop05
- Errors & strict mode06
- DOM & events07
- Browser APIs08
- Modules & builds09
- Performance & patterns10
- The model11
- + 5 more inside
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.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.