Understanding null vs. undefined vs. Empty String in Javascript


Distinguish between null, undefined, and an empty string (“”).

Source Code

let a = null; // Explicitly nothing
let b; // Not assigned a value, thus undefined
let c = ""; // A string with no characters
console.log(a, b, c);
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments