What Does “Undefined” Mean in JavaScript? (Example Included)

When JavaScript says something is undefined, it literally means that there’s no meaning or value for the value you’re searching for.

You basically haven’t assigned a value to the variable yet.

Check out this example of something being undefined:

let thisVariable;
console.log(thisVariable)

This output will show undefined because you didn’t initialize or assign “thisVariable” a value.

The correct way is:

let thisVariable = 123;
console.log(thisVariable);

This output is:

123

Which is defined!

Leave a Comment