top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between undefined value and null value?

0 votes
286 views
What is the difference between undefined value and null value?
posted Aug 6, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Undefined: a variable has been declared but has not yet been assigned a value.
null: It can be assigned to a variable as a representation of no value.

Example (Undefined):

 var a;
 alert(a); //shows undefined
 alert(typeof a); //shows undefined

Example (null):

 var a = null;
 alert(a); //shows null
 alert(typeof a); //shows object
answer Aug 6, 2014 by Salil Agrawal
Similar Questions
+1 vote

I search most of the article available in the internet, but i am able to clear on this two statement

1/0 is undefined or infinity.
1/infinite is zero or undefined.

But i am clear about the things if we will use lim (x->infinite) 1/x approaches to zero

...