3
Reply

What is the difference between undefined and null in JavaScript?

Sanjay Dixit

Sanjay Dixit

May 13, 2013
778
0

    1. console.log(a); /* undefined */var b;2. console.log(b); /* null */

    Guru Bandgar
    May 23, 2016
    0

    In JavaScript, undefined means a variable has been declared but has not yet been assigned a value, null is an assignment value. It can be assigned to a variable as a representation of no value:

    Abhijeet Gupta
    November 02, 2015
    0

    undefined is a type itself (undefined) while null is an object.

    Jaganathan Bantheswaran
    November 04, 2014
    0