Typeof Multiple Types
Predict Output Beginner
Question
What does this code print?
Code
console.log(typeof 42, typeof "hi", typeof true, typeof undefined);
Hint
Each typeof returns the type name as a string.
Explanation
typeof 42 is "number", typeof "hi" is "string", typeof true is "boolean", and typeof undefined is "undefined". console.log with multiple arguments prints them space-separated. The output is: number string boolean undefined
Related Resources
Related Lessons
- Data Types
Learn about primitive 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.