Back to the 2024 paper

Module III: Basics of Web Programming

20242m

In JavaScript, what is the result of the following expression: typeof null? (i) null (ii) object (iii) undefined (iv) boolean

Worked SolutionAI Assisted

Answer: (ii) object

typeof null returns "object". This is a long-standing bug from the first version of JavaScript, where null was represented with the object type tag, and it was kept for backward compatibility. To test for null, use value === null.

Similar questions

AI LearningWeb Platform

Coursify — Personal AI Course Generator

Struggling with a difficult subject or concept? Turn any engineering topic into a structured course with interactive lessons, quizzes, and research-backed explanations.