---
title: "Discussion on \"Why (typeof null) returns an object in JavaScript?\" | Hashnode"
description: "Discussion on \"Why (typeof null) returns an object in JavaScript?\". Lets discuss and understand this well known  bug in JavaScript that was kept intentionally due to compatibility and existing flow of the code.null is a primitive value in JavaScript.\nconsole.log(typeof \"MyName\");  // string\nconsole.log(typeof true); ..."
url: "https://hashnode.com/posts/why-typeof-null-returns-an-object-in-javascript/68910115e147edf32ce45422"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Why (typeof null) returns an object in JavaScript?](https://bitzloop.hashnode.dev/why-typeof-null-returns-an-object-in-javascript?utm_source=hashnode&utm_medium=feed)

Lets discuss and understand this well known bug in JavaScript that was kept intentionally due to compatibility and existing flow of the code.null is a primitive value in JavaScript. console.log(typeof "MyName"); // string console.log(typeof true); ...

Aug 4, 2025 · 2 min read · bitzloop.hashnode.dev  
Read the article

-   [#javascript-bugs](https://hashnode.com/tag/javascript-bugs)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#javascript-typeof](https://hashnode.com/tag/javascript-typeof)

## Written by

[Rohan Dhara](https://hashnode.com/@Rohan30z)

@Rohan30z

  
[View profile](https://hashnode.com/@Rohan30z)

while(noJob)

## Responses 2

Markdown supported · ⌘↵ to post

[Mayank Jha](https://hashnode.com/@Mayankjha613)

[Aug 6, 2025](https://hashnode.com/posts/why-typeof-null-returns-an-object-in-javascript/68910115e147edf32ce45422/comment/689304396df1ff7d0b13ac7e)

Great insight ✨️

[Rohan Dhara](https://hashnode.com/@Rohan30z)

[Aug 7, 2025](https://hashnode.com/posts/why-typeof-null-returns-an-object-in-javascript/68910115e147edf32ce45422/comment/689304396df1ff7d0b13ac7e#reply-68945321046157fcabcc1a03)

Thank you 😊

[Priyojit Singha](https://hashnode.com/@priyojitsingha)

[Aug 5, 2025](https://hashnode.com/posts/why-typeof-null-returns-an-object-in-javascript/68910115e147edf32ce45422/comment/689219c425016e6b466d9aa0)

A very important concept made understand very easily. Good one

[Rohan Dhara](https://hashnode.com/@Rohan30z)

[Aug 5, 2025](https://hashnode.com/posts/why-typeof-null-returns-an-object-in-javascript/68910115e147edf32ce45422/comment/689219c425016e6b466d9aa0#reply-6892381dfbc03431e2f2a1b0)

Thank you
