Fundamentals
JavaScript Fundamentals Test
20 multiple choice questions on core JavaScript: variables, types, arrays, closures, promises and the event loop.
- Questions
- 20
- Time
- 20 min
- Pass mark
- 60%
No account or email needed.
About this test
This test checks the parts of JavaScript that come up in almost every web developer interview: how values and types behave, how arrays and objects work, how closures and this work, and the order in which asynchronous code runs.
Some questions show a short snippet and ask what it prints. Read the code carefully, because many of them are built around a well-known quirk of the language.
What it covers
The question set has 24 questions: 9 easy, 13 medium and 2 hard. Each attempt draws 20 of them at random, so a second try is not the same test.
- JavaScript (24)
Try a few sample questions
These are real questions from the set, with the answers and a short explanation. Read the question, decide, then open it to check.
Sample 1 · JavaScript · easyWhat does typeof null return in JavaScript?Show the answer
- "null"
- "object"Correct
- "undefined"
- "number"
This is a long-standing quirk of the language. typeof null is "object", so check for null with value === null instead.
Sample 2 · JavaScript · easyWhich keyword declares a block-scoped variable that can be reassigned?Show the answer
- var
- letCorrect
- const
- function
let is block-scoped and can be reassigned. const is block-scoped but cannot be reassigned. var is function-scoped.
Sample 3 · JavaScript · easyWhat does this code print?Show the answer
console.log(0.1 + 0.2 === 0.3);- true
- falseCorrect
- undefined
- It throws a TypeError
Numbers are stored as binary floating point, so 0.1 + 0.2 is 0.30000000000000004, which is not equal to 0.3.
How it works
- 20 multiple choice questions, drawn at random from a larger set.
- 20 minutes on the clock. The test submits itself when time runs out.
- Pass mark: 60%.
- No marks are taken off for wrong answers, so answer every question.
- Some questions have more than one correct answer. You must pick all of them to score.
- When you finish you see your score, the correct answers and a short explanation for each.
- Your answers save as you go, so a dropped connection will not lose your work.
- Please stay on the test page. Switching to another tab or window is recorded and you will see a warning.
- Copying text, printing and screenshots are not allowed during the test.
More practice tests
- Git and Web Basics TestFundamentals
- Python Basics TestFundamentals
- React Fundamentals TestFundamentals
- SQL Basics TestFundamentals
See all practice tests.
