From 82d13f0a4d3b048703d99f64a0547c584601afd8 Mon Sep 17 00:00:00 2001 From: Claudia Benito Date: Wed, 17 Jan 2024 03:45:00 +0100 Subject: [PATCH] fix(quiz): Update en-US.mdx (#408) --- .../en-US.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/quiz/questions/what-are-the-differences-between-variables-created-using-let-var-or-const/en-US.mdx b/packages/quiz/questions/what-are-the-differences-between-variables-created-using-let-var-or-const/en-US.mdx index 7f7028a66..02651e0e6 100644 --- a/packages/quiz/questions/what-are-the-differences-between-variables-created-using-let-var-or-const/en-US.mdx +++ b/packages/quiz/questions/what-are-the-differences-between-variables-created-using-let-var-or-const/en-US.mdx @@ -35,7 +35,7 @@ console.log(baz); // ReferenceError: baz is not defined console.log(qux); // ReferenceError: qux is not defined ``` -`var` allows variables to be hoisted, meaning they can be referenced in code before they are declared. `let` and `const` will not allow this, instead throwing an error. +`var` ,`let` and `const` declared variables are all hoisted. `var` declared variables are auto-initialised with an undefined value. However, `let` and `const` variables are not initialised and accessing them before the declaration will result in a `ReferenceError` exception because they are in a "temporal dead zone" from the start of the block until the declaration is processed. ```js console.log(foo); // undefined