ES2020+ · 15 QUESTIONS · ABOUT 10 MINUTES

Read the code. Predict what JavaScript does.

Fifteen short snippets, from type coercion to the order promises run in. Each answer comes with the rule behind it, and your result is broken down by topic. No sign-up, nothing saved.

Start the JavaScript test
> "5" + 3'53'> "5" - 32> typeof null'object'> [10, 1, 2].sort()[1, 10, 2]
QUESTION 1 / 15 · TYPES & COERCIONEasy

What does this log?

console.log("5" + 3, "5" - 3);

What this JavaScript test measures, in short

This test checks whether you can predict what real JavaScript does: how values convert, how equality works, where variables live, and in what order asynchronous code runs. It rewards knowing the language's rules over knowing a framework.

Every snippet behaves the same in any modern browser or in Node.js. The questions are our own and are not standardised against a population, so treat the result as a check on your knowledge, not a certification.

By What's Your IQ · Reviewed 4 Oct 2026
Format
15 predict-the-output questions, 4 options each
Topics
Types and coercion, objects and arrays, scope and hoisting, async and the event loop
Standard
ECMAScript (ECMA-262), with a new edition every June since 2015
Language
Created by Brendan Eich at Netscape in 1995
QUESTION 14, STEP BY STEP

Why a promise beats a zero-second timer

JavaScript runs one thing at a time. Callbacks wait in two queues, and the promise queue (microtasks) is always emptied before the next timer (task) gets a turn. Step through it.

CALL STACK
log(1)
MICROTASKS
[object Object]
TASKS
[object Object]
CONSOLE
1
Synchronous code runs top to bottom. console.log(1) goes on the call stack and prints immediately.
OLD HABITS, MODERN FIXES

Most gotchas have a modern way out

OLDER STYLE
var total = 0;for (var i = 0; i < 3; i++) { total += i;}// i is still 3 out here
MODERN
let total = 0;for (let i = 0; i < 3; i++) { total += i;}// i doesn't exist out here

let and const are scoped to their block, can't be used before their line and, with const, can't be reassigned. That removes the traps in questions 10 to 13.

98%of websites use JavaScript in the browserAccording to W3Techs' ongoing survey of the most-visited sites, making it the most widely deployed programming language there is.1
1995Ten days at Netscape. Brendan Eich wrote the first version, called Mocha, then LiveScript. It was renamed JavaScript for marketing reasons; it has little to do with Java.2
1997Standardised. Ecma International published the first edition of ECMA-262, the ECMAScript standard every browser engine now follows.3
2015The big update. ES2015 added let, const, arrow functions, classes, promises and modules, and fixed most of the traps in questions 10 to 13. Editions have been yearly since.3
2024 surveyStill the most used. About 62% of respondents to Stack Overflow's survey had used JavaScript in the past year, keeping it the most-used language in that survey for over a decade.4
  1. W3Techs. Usage statistics of JavaScript as client-side programming language on websites.
  2. Wirfs-Brock, A., & Eich, B. (2020). JavaScript: The first 20 years. Proceedings of the ACM on Programming Languages, 4(HOPL), 1–189.
  3. Ecma International. ECMA-262: ECMAScript Language Specification.
  4. Stack Overflow. (2024). 2024 Developer Survey: Technology.

Where to go next

Knowing JavaScript is one thing. How do you reason?

Our full IQ test measures the pattern-finding and working memory that make debugging easier: 60 questions across four domains, about 30 minutes.

Take the full IQ test