let is constrained to whichever scope it is declared in. Its declaration and assignment are similar to var . ... Unlike var , variables cannot be re-declared using let , trying to do that will throw a Syntax error: Identifier has already been declared.
Can let variables be hoisted?
Variables declared with let and const are also hoisted, but unlike for var the variables are not initialized with a default value of undefined .
Which is the proper way to assign a variable?
When you assign a variable, you use the = symbol. The name of the variable goes on the left and the value you want to store in the variable goes on the right. Here we've assigned the value 'Joe' , which is a string, to the variable first_name .