Your product could be here, in front of thousands of JavaScript developers. Sponsor this spot →
JavaScript Quiz

JavaScript Basics Quiz for Beginners

Start here if you’re new to JavaScript. These questions cover the fundamentals: let, const and var, == vs ===, truthy and falsy values, logical operators and loops.

Each one is a short snippet. Guess the output, then read why.

Basics questions

  1. What happens when you reassign a const in JavaScript?
  2. Why is typeof null "object" in JavaScript?
  3. What is the difference between == and === in JavaScript?
  4. What does Array.push() return in JavaScript?
  5. Is a var loop variable accessible after a for loop?
  6. Why does "5" * "2" equal 10 in JavaScript?
  7. Is an empty array truthy in JavaScript?
  8. Is null equal to undefined in JavaScript?
  9. What is the difference between a++ and ++a in JavaScript?
  10. What does || return in JavaScript?
  11. What does the && operator return in JavaScript?
  12. What happens if you forget break in a JavaScript switch?
  13. What is -7 % 3 in JavaScript?
  14. Why is {} === {} false in JavaScript?
  15. Are JavaScript objects copied by reference?
  16. Why does a return on its own line return undefined?
  17. What happens when you call a function with missing arguments?
  18. How do you swap two variables with destructuring?
  19. Can you push to a const array in JavaScript?

More topics