Skip to content

Commit 76d1372

Browse files
committed
Improve answer 1
1 parent 68f6741 commit 76d1372

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ sayHi();
3333

3434
Within the function, we first declare the `name` variable with the `var` keyword. This means that the variable gets hoisted (memory space is set up during the creation phase) with the default value of `undefined`, until we actually get to the line where we define the variable. We haven't defined the variable yet on the line where we try to log the `name` variable, so it still holds the value of `undefined`.
3535

36-
Variables with the `let` keyword (and `const`) don't get hoisted. They are not accessible before the line we declare them. This means that there is no reference yet to the variable `age`, yet we try to access it. JavaScript throws a `ReferenceError`.
36+
Variables with the `let` keyword (and `const`) are hoisted, but unlike `var`, don't get <i>initialized</i>. They are not accessible before the line we declare (initialize) them. This is called the "temporal dead zone". When we try to access the variables before they are declared, JavaScript throws a `ReferenceError`.
3737

3838
</p>
3939
</details>

0 commit comments

Comments
 (0)