Typeof Array
Multiple Choice Beginner
Question
What does typeof [] return?
Hint
Arrays are objects in JS.
Explanation
typeof [] returns "object" because arrays are a special type of object in JavaScript. To check if a value is an array, use Array.isArray() which returns true for arrays and false for everything else. This is a common gotcha when type-checking.
Related Resources
Related Lessons
- Data Types
Learn JS data types.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.