Sukhjinder Arora
Sep 1, 2018 · 1 min read

As you have edited your first comment, my reply was in response to your original comment. As you said, you can “reference” the let variables in a function, before they are declared in the source code, but cannot “access” them if the function is called before the variable declaration. So the line “ you can’t access them before they are declared” is still true.

And let and const variables are also hoisted just as var variables, but they remain uninitialized as opposed to var variables which are set to undefined. The JavaScript engine does not set any value to these variables until it reaches the actual place the variable was declared and set it to undefined if its value couldn’t be found.

    Sukhjinder Arora

    Written by

    Web Developer. Tech Writer. Loves poetry, philosophy and programming. Find me @ https://sukhjinderarora.com/