Understanding null vs. undefined in Javascript


null is an assigned value meaning “no value,” while undefined means a variable has been declared but not yet assigned a value.

Source Code

let notAssigned;
let explicitlySetToNoValue = null;
console.log(notAssigned); // undefined
console.log(explicitlySetToNoValue); // null
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments