I'm from a Java background and started learning JavaScript.
Declaring variables in JavaScript using the keyword let
sounds like is uses similar scope rules of declaring variables in Java. The concept of hoisting in JavaScript is confusing (consider my C++/Java background) and I don't see any pitfalls in using let
in place of var
.
Is my understanding correct?