Great article, I would only add an extra thing about the hoisting, many people think that let and const declarations wont be hoisted, but you are right, there are hoisted. The reason to get the ReferenceError is because the initialization of those variables has not happened yet and those are referencing to the temporal dead zone (developer.mozilla.org/en-US/docs/W...), throwing the error.
Great article, I would only add an extra thing about the hoisting, many people think that let and const declarations wont be hoisted, but you are right, there are hoisted. The reason to get the
ReferenceError
is because the initialization of those variables has not happened yet and those are referencing to the temporal dead zone (developer.mozilla.org/en-US/docs/W...), throwing the error.thanks for this great article 👍.
Good call! Thanks!