Difference between Null and Undefined | JavaScript Tutorials in Hindi | Interview Question #18
In JavaScript, null and undefined are both used to represent absence of value, but they have slightly different meanings:
undefined: A variable is said to be undefined when it has been declared but has not been assigned a value. It is also the default value of function arguments that have not been provided a value.
null: It is a value that represents no value or an intentional absence of an object value.
In summary, undefined means a variable has not been assigned a value or does not exist, while null represents an intentional absence of a value.