JavaScript : ‘null’ vs ‘undefined’

lost here

Difference between ‘null’ and ‘undefined’?

Many of you still think that in JavaScript, null and undefined are same, but answer is:

null !== undefined

1. null

The value null represents the intentional absence of any object value. It is one of JavaScript’s primitive values and is treated as falsy for boolean operations.

If I say null is an object? Would you believe me? Watch below gif

gif demonstrating null

It was surprising to me also, but this the wonderful JavaScript. We should really understand the working of JavaScript.

null means empty and can be assigned and which means nothing.

2. undefined

The global undefined property represents the primitive value undefined. It is one of JavaScript’s primitive types., what you are thinking is not like that ? undefined is not an object like null

gif demonstrating undefined

undefined means a variable which was declared but not yet been assigned any value.

example for undefined

undefined is of type undefined



undefined is something which is not defined and is of undefined type

null is empty and having no value and is of object type

There are many thing which is still to explore by us in JavaScript. JavaScript really very deep and powerful. Invest your time to learn JavaScript by considering example for each concept you learn.

4 thoughts on “JavaScript : ‘null’ vs ‘undefined’”

  1. Nitin Motwani says:

    Very Helpful…

  2. Ashutosh Mishra says:

    Thank you for your valuable information

  3. html5 games says:

    Thank you for the good writeup. It in fact was a amusement account it.

    Look advanced to far added agreeable from you!

    However, how could we communicate?

    1. ashishkumar says:

      Hello buddy,

      good to know that you loved it.

      we can connect on personally, or for any general query mail us @

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Blog Banner

What is Blog?What is Blog?

Hello guys, so here are we with some another concept viz. Blog. So, What is a blog? A blog (a truncation of “weblog”) is a discussion or informational website published