🟨 JavaScript Interview Questions
Master JavaScript interviews with questions on closures, promises, async/await, and ES6+ features
15-Minute JavaScript Cheatsheet
Quick reference for last-minute interview preparation
🎯 Core Concepts
✨ ES6+ Features
let/const - Block scoped variablesarrow => - Lexical this binding... - Spread/rest operator`template` - Template literalsdestructuring - Extract values⏳ Async JavaScript
📦 Objects & Arrays
map/filter/reduce - Array methodsObject.keys/values/entriesObject.assign/spread - MergeJSON.parse/stringify🔗 Prototypes & Classes
__proto__ - Object's prototypeclass - Syntactic sugarextends - Class inheritancesuper - Parent reference🌐 DOM & Events
addEventListenerpreventDefault/stopPropagation⚠️ Common Interview Gotchas
var, let, and const are used for variable declaration but have different scoping and hoisting behaviors.
A closure is a function that remembers its lexical scope even when executed outside that scope. It "closes over" its outer variables.
The event loop is JavaScript's mechanism for handling asynchronous operations. It continuously checks the call stack and processes callbacks from the task queue.
this refers to the execution context. Its value depends on how a function is called, not where it's defined.
Promises represent eventual completion of async operations. async/await is syntactic sugar that makes async code look synchronous.
JavaScript uses prototypal inheritance where objects inherit directly from other objects through the prototype chain.
== performs type coercion before comparison, while === checks both value and type without coercion.
Higher-order functions take functions as arguments or return functions. map, filter, and reduce are essential array methods.
Event bubbling is when events propagate from child to parent. Event delegation uses this to handle events on a parent instead of individual children.
Hoisting moves declarations to the top of their scope during compilation. Variables and functions are hoisted differently.
The spread operator ... expands iterables into individual elements. The rest operator collects multiple elements into an array.
ES6 modules allow splitting code into separate files with explicit imports and exports for better organization and reusability.
Destructuring extracts values from arrays or properties from objects into distinct variables using a concise syntax.
undefined means a variable has been declared but not assigned a value. null is an intentional assignment representing "no value."
Generators are functions that can pause execution and resume later. Iterators are objects that define a sequence and return values one at a time.
WeakMap and WeakSet hold "weak" references to objects, allowing them to be garbage collected when no other references exist.
Proxy wraps an object and intercepts operations like property access, assignment, and function calls, enabling custom behavior.
JavaScript provides try-catch-finally for synchronous errors and Promise rejection for async errors. Custom error classes enable specific error handling.
Debouncing delays execution until after a pause in calls. Throttling limits execution to at most once per time period. Both optimize performance.
Design patterns are reusable solutions to common programming problems. JavaScript commonly uses Module, Singleton, Factory, Observer, and other patterns.
Interview Tips for JavaScript
- ✓ Understand closures and how they capture variables
- ✓ Know the event loop, call stack, and task queues
- ✓ Master Promises and async/await patterns
- ✓ Understand prototypal inheritance vs class syntax
- ✓ Know the differences between var, let, and const
- ✓ Practice array methods: map, filter, reduce
- ✓ Understand 'this' binding in different contexts
- ✓ Be ready to implement debounce, throttle, and other utilities