NULL is a value. You assign this value to the variable or object to wipe out all the data in it.
Undefined not gives you any choice. You have to assign data to the variable or object before using it.
Let’s see Examples.
let flag; console.log(flag);
In the above example you can see we have declared flag variable BUT not assigned any value/data to it. On the next line we are using variable flag to display data in it.
let flag; flag = null; console.log(flag);
In the above example, We have assigned NULL value to the flag variable. So, you will get NULL in the console log.
That’s it. We hope you get some idea regarding NULL and undefined.