namaste-javascript-notes

Episode 6 : undefined vs not defined in JS

When variable is declared but not assigned value, its current value is undefined. But when the variable itself is not declared but called in code, then it is not defined.

console.log(x); // undefined
var x = 25;
console.log(x); // 25
console.log(a); // Uncaught ReferenceError: a is not defined

Watch Live On Youtube below:

undefined vs not defined in JS Youtube Link