JavaScript Quiz

Thirty questions covering the whole course. Choose an answer for each, then press Check answers at the bottom to see your score and an explanation for every question.

1. Where is the recommended place to load a script that works with the page?

2. Which keyword should you use by default for variables?

3. What does typeof null return?

4. What is "5" + 3?

5. What is "5" - 3?

6. Which comparison is true?

7. What does 0 ?? 10 evaluate to?

8. In a switch, what happens if you leave out break?

9. Which loop gives you the VALUES of an array?

10. What does "hello".at(-1) return?

11. Why does 0.1 + 0.2 === 0.3 return false?

12. Which of these values is truthy?

13. In new Date(2026, 0, 15), which month is it?

14. What does an arrow function NOT have of its own?

15. What happens if you use a let variable before its declaration line?

16. What is a closure?

17. What does ["1", "2", "3"].map(parseInt) return?

18. Which method changes the original array?

19. What does find return when nothing matches?

20. What does [10, 9, 1].sort() produce?

21. How do you make a copy of an array?

22. What is the quickest way to remove duplicates from an array?

23. What does Object.entries({ a: 1 }) return?

24. Where do class methods actually live?

25. What makes a class field truly private?

26. What does JSON.stringify do with a function property?

27. Which property safely sets text that came from a user?

28. What is event delegation?

29. Does fetch reject its promise for a 404 response?

30. In what order does this print? setTimeout(() => log("A")); Promise.resolve().then(() => log("B")); log("C");

Missed a few? Each explanation names the lesson to revisit. When you're ready, try the exercises.