← All open source projects

JavaScript Questions

lydiahallie/javascript-questions

JavaScript Questions is a large collection of JavaScript behavior questions with explanations.

Forks 9,219
Author lydiahallie
Language Unknown
License MIT
Synced 2026-06-20

What it is

JavaScript Questions is a collection of JavaScript questions with answers and explanations. The questions focus on language behavior: scope, closures, async execution, objects, classes, types, operators, and surprising outputs.

The useful part is prediction. You do not only read an explanation; you first decide what the code will do, which exposes the gap between recognizing syntax and understanding behavior.

Why the format works

JavaScript has many places where short snippets behave differently from what developers expect after other languages. The repository turns those situations into small checks of understanding.

This is not an algorithm challenge collection. It tests the language and runtime details that often appear during debugging and interviews.

Execution order question

This example shows the style: before running it, you need to reason about what runs immediately and what is scheduled for later.

Language: JavaScript
console.log("A");

Promise.resolve().then(() => console.log("B"));
setTimeout(() => console.log("C"), 0);

console.log("D");

What is inside

The repository contains many short snippets with answer choices and collapsed explanations. That is useful for self-testing: answer first, then compare your reasoning.

Community translations make it easier to use in groups and teams where not everyone wants to read complex explanations in English.

Strengths

The main strength is density. One question can expose several topics at once: coercion, scope, microtasks, or object references.

It works for interview preparation, but it is even better as a team exercise. Different answers to the same snippet open a useful discussion about the execution model.

Limits

The collection does not replace systematic JavaScript study. Memorizing answers is weak; a similar snippet with different order will break that memory.

The language also evolves, and some questions reflect the syntax and practices from the time they were written. Use it as reasoning practice, not as a complete reference.

Who it fits

JavaScript Questions helps developers checking language understanding, preparing for interviews, or running internal learning sessions.

The best way to use it is slowly: choose a few questions, write your expected result, explain why, and only then open the answer.