JavaScript problems.
Solved in 4 minutes each.
Every page here answers one specific question — the exact thing you typed into Google. No filler. Just the answer, working code, the reason it works, and the mistakes to avoid. This is what you need when this is undefined, the loop closes over the wrong variable, or the promise never resolves.
How to use this page. Find your problem in the list below. Click it. The answer is the first thing on the page — no scrolling required. Every page has a "Short answer" box at the top, followed by the working code, then the explanation. If you're looking for a structured learning path instead, the JavaScript learning path covers every concept from scratch.
🔒 Scoping & functions
The parts of JavaScript that surprise everyone the first time.
var vs let vs const
Function scope vs block scope — and why const doesn't mean immutable.
What is a closure?
A function that remembers its outer variables. The pattern, the gotcha, and where it shows up.
What is this in JavaScript?
The five different values of this depending on how a function is called.
What is hoisting?
Why you can call a function before declaring it — and why let breaks that.
⏳ Async
Promises, async/await, and the event loop.
📊 Arrays & objects
The methods and patterns you use every day.
Array methods: map, filter, reduce
The three that cover 90% of array work — with real examples.
map vs filter vs reduce
Which one transforms, which one selects, which one aggregates.
Object.keys, values, entries
Iterating over objects — and the difference between the three.
JSON.parse and JSON.stringify
The two methods — and the edge cases that bite (dates, undefined, circular refs).
✨ Modern syntax
ES2015+ features that make code shorter and clearer.
Spread vs rest
Same syntax, opposite purpose. When to use each.
Destructuring explained
Object and array destructuring, defaults, and nested patterns.
Optional chaining
Safe property access — and why it's not a substitute for validation.
Template literals
Backticks, interpolation, tagged templates, and multi-line strings.
⚠️ Errors & gotchas
The behaviors that don't work the way you expect.
null vs undefined
Two "nothing" values — when to use which, and how to check for them.
== vs ===
Loose equality vs strict equality — and the coercion rules behind each.
String methods
slice, split, replace, includes, padStart — with the gotchas each one has.
Debounce vs throttle
Two patterns that look the same but solve different problems.
Event delegation
One listener for many elements — the pattern and its performance implications.
📋 All 20 problems
Sorted by category. Click any to jump straight to the answer.