DEV Community

Play Button Pause Button
Manav Misra
Manav Misra

Posted on

`undefined` Does NOT Mean 'not defined' πŸ˜•

TLDW

let is a keyword that we use to declare variables in memory.

This may be done in the global scope. In that case, if we don't use the assignment operator =, our variable will be bound to the primitive data type, undefined (absence of a value - ironically, it itself is a value! πŸ€·πŸ½β€β™‚οΈ).

We can also see undefined if we access a πŸ”‘in an object that doesn't exist...it doesn't have a *value...*there is an 'absence of a value.'

However, if we access a variable in the global scope that doesn't exist, we are 'referencing a variable erroneously.' That...is when we will see a ReferenceError with a message saying that something is not defined.

Top comments (0)