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