JavaScript MCQ Basic JavaScript MCQ Question #4858
Single Choice Not Set

QWhat is the result of the following code?
let x = null; console.log(typeof x);

ID: #4858 Basic JavaScript MCQ 301 views
Question Info
#4858Q ID
Not SetDifficulty
Basic JavaScript MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A null
  • B 'null'
  • C 'object'
  • D undefined
Correct Answer

Explanation

The result of the code is 'object'.
In JavaScript, the typeof operator returns a string that represents the type of a value.
However, the typeof operator has a few quirks,
one of which is that it returns 'object' for null values.
This is a known issue in JavaScript, and it can cause confusion for developers who are not aware

Share This Question

Challenge a friend or share with your study group.