Q. In a case, where the value of the operator is NULL , the typeof returned by the unary operator is___.
β
Correct Answer: (D)
object
Explanation:
Let's solve it carefully:
In JavaScript, if the value is null, and you apply the typeof unary operator, for example:
typeof null
Then the result is: "object".
Reason:
- It's a well-known historical bug in JavaScript:
typeof null returns "object", even though null is a primitive. - This behavior is maintained for backward compatibility.
Therefore, the correct answer is:
(D) object