QuizBytesDaily← All quizzes
HomeQuizJavaScript

JavaScript Quiz Questions

From event loop quirks to modern ES2024+ features

Take JavaScript Quizzes →

About JavaScript Quizzes

JavaScript is the only language that runs natively in every web browser, and with Node.js it powers servers, CLIs, and serverless functions too. Its ubiquity makes it essential — but JavaScript's design decisions, accumulated over 30 years of backwards-compatible evolution, produce some genuinely surprising behaviours that catch even senior engineers off guard.

QuizBytesDaily's JavaScript quizzes explore the language at a deeper level than tutorials typically cover. We dive into the event loop and microtask queue, prototype chains and `this` binding, closures and lexical scope, the differences between `var`, `let`, and `const`, and why certain patterns work in strict mode but not in sloppy mode.

Modern JavaScript (ES6 through ES2024) has transformed how we write code: arrow functions, destructuring, optional chaining, nullish coalescing, Promises, async generators, top-level await, and more. Our quizzes cover both the legacy behaviours you need to understand to debug old codebases, and the modern features you should be using in new code.

Why Learn JavaScript?

Universal language
JavaScript is the only language that runs in the browser without transpilation. Full-stack JS engineers are in high demand.
Quirks matter in production
Type coercion bugs, closure-in-loop pitfalls, and async ordering errors are common sources of production incidents. Knowing the language deeply prevents them.
Modern ecosystem
React, Vue, Next.js, Node.js, Deno, Bun — all are built on JavaScript. Understanding the foundation makes every framework easier to learn.

What You'll Find in Our JavaScript Quizzes

  • Closures, scope, hoisting, and the temporal dead zone
  • Prototype chain, `this` binding, and `new` keyword
  • Event loop, call stack, microtask queue, and macrotask queue
  • Promises, async/await, and error handling patterns
  • ES6+ features: destructuring, spread, generators, symbols
  • Type coercion and equality (`==` vs `===`)
  • Module systems: CommonJS, ESM, dynamic imports
Sponsored

Other Quiz Categories

🐍 Python🤖 AI & Machine Learning🧮 Algorithms🏗️ System Design📘 TypeScript

Sample JavaScript Quiz Questions

A taste of what you'll find in the JavaScript quiz series.

1

What does `typeof null` return in JavaScript?

A."null"
B."undefined"
C."object"✓ Correct
D."boolean"

Explanation: typeof null returns "object" — this is a well-known bug from the original JavaScript implementation in 1995. In the early engine, values were stored as a tag + value pair. The null pointer (0x00) happened to share the same type tag as objects. The bug was never fixed because doing so would break vast amounts of existing code. This is why null checks should use strict equality (`=== null`) rather than typeof.

2

What is the output of `0.1 + 0.2 === 0.3` in JavaScript?

A.true
B.false✓ Correct
C.TypeError
D.NaN

Explanation: This evaluates to false. JavaScript uses 64-bit IEEE 754 floating-point arithmetic, and 0.1 and 0.2 cannot be represented exactly in binary — they are stored as repeating fractions. The actual sum is 0.30000000000000004, not 0.3. To compare floating-point numbers, use a tolerance: `Math.abs(0.1 + 0.2 - 0.3) < Number.EPSILON`.

3

Which of the following correctly describes the JavaScript event loop?

A.JavaScript is multi-threaded and runs callbacks in parallel
B.The event loop blocks execution until all microtasks are cleared before processing the next macrotask✓ Correct
C.setTimeout callbacks always run before Promise callbacks
D.The call stack and the event queue run on separate threads simultaneously

Explanation: JavaScript is single-threaded. After each macrotask (e.g. setTimeout callback, I/O event), the event loop empties the entire microtask queue (resolved Promises, queueMicrotask) before picking up the next macrotask. This is why `Promise.resolve().then(...)` always executes before a `setTimeout(..., 0)` callback scheduled before it — microtasks have higher priority than macrotasks.

Sponsored

Ready to test your JavaScript knowledge?

Free daily quizzes — no signup, no account, no cost.

Start JavaScript Quizzes →