if we declare but not use then its undefined if we didnot declare then its null
Interviews4 answers
What is the difference between undefined and null in JavaScript?
4 Answers
Bidyasagar MishraPosted Aug 1, 2019, 9:56 PM EDT
1. console.log(a); /* undefined */
var b;
2. console.log(b); /* null */
Guru BandgarPosted May 22, 2016, 10:17 PM EDT
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 GuptaPosted Nov 2, 2015, 9:25 AM EST
undefined is a type itself (undefined) while null is an object.
Jaganathan BantheswaranPosted Nov 3, 2014, 10:51 PM EST



