Question 4
Back to Exercise
What does the following JavaScript code print (console output, as in Node.js)?
console.log(typeof 42, typeof "42", typeof true, typeof undefined);
- A number string boolean undefined Correct
- B number number boolean undefined
- C int string bool undefined
- D number string boolean null
Correct Answer: Option A
typeof returns lower-case type names. "42" in quotes is a string; JavaScript has one number type, not int.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!