Why typeof null === “object” in JavaScript

📰 Medium · JavaScript

Learn why typeof null returns 'object' in JavaScript and how to handle this quirk

intermediate Published 24 May 2026
Action Steps
  1. Check the type of null using the typeof operator
  2. Compare the result with other primitive types like undefined and boolean
  3. Investigate the historical reason behind this behavior in JavaScript
  4. Apply the knowledge to write more robust type checks in your code
  5. Test your understanding with sample code snippets
Who Needs to Know This

JavaScript developers and interviewers can benefit from understanding this concept to avoid common mistakes and improve code quality

Key Insight

💡 The typeof operator returns 'object' for null due to a historical reason in JavaScript's development

Share This
Did you know? typeof null === 'object' in JavaScript!

Key Takeaways

Learn why typeof null returns 'object' in JavaScript and how to handle this quirk

Full Article

And the interview question that sent me down a rabbit hole. Continue reading on Medium »
Read full article → ← Back to Reads