Output-Based JavaScript Questions

This JavaScript quiz collects the "what does this print?" snippets that come up again and again in interviews. You will reason about typeof, type coercion, hoisting, this, sorting and the order of timers and promises.

Medium 10 questions ~6 minutes Pass at 80% Node.js 22

Choose a mode

Playing as a guest: sign in to keep your XP and streak.

Sample question

Question 1 of 10

What does this print?

console.log(typeof null, typeof [], typeof NaN);
Show the answer

A. object object number typeof null is "object", a famous historical bug. Arrays are objects (use Array.isArray() to tell them apart), and NaN is a value of type number.

What this quiz covers

  • typeof surprises and floating point results
  • Coercion with + and ==
  • Hoisting of var and function expressions
  • this in regular vs arrow callbacks
  • Microtasks vs setTimeout order

Questions people ask

Do I need an account?

No. Anyone can play. Sign in to keep your XP, streak, badges and history.

Can I retake it?

Yes. Your best score is kept, and the questions and answers are shuffled each time.