Declaration vs Initialization

"Uncaught ReferenceError: a is not defined"

Have you ever got this kind of error?

And you are now confused between declaration and initialization.
So, here is a short blog to differentiate.

This is a declaration. We are telling our program that a variable exists.

let num;

This is an initialization. We are initialization the num variable with the value of 15.

num = 15

Most of the time you'll do the declaration and initialization at the same time.

let num = 15

By calling a variable before it is declared results in ReferenceError.

And by just declaring it and not initializing it. The variable is assigned value as undefined.

Thanks for reading.