DEV Community

 Bishnu Prasad Chowdhury
Bishnu Prasad Chowdhury

Posted on • Updated on

Javascript not defined vs undefined

undefined example:

console.log(a) 
// memory reserved for a
var a = 5;
console.log(a)
Enter fullscreen mode Exit fullscreen mode

Output:
undefined
5

Not defined example:

console.log(b)
// No memory is reserved
Enter fullscreen mode Exit fullscreen mode

Output:

Uncaught reference error: b is not defined

Top comments (0)