ES2015 - let and const
Some useful information I have found on the new let and const functionality. I have started using this and converting it with babel to es3 however this loses all the nice features its provided. But at least its future proofing.
You can only declare each let name once.
Temporal Dead zone
You can not call a let before its been created
Let creates a block scoped variable
Let in for loops
When using let in a for loop its not accessible outside the loop and is scoped to the block. The same principle as above.
You can’t reassign to a const variable. Its scoped the same as let lexically inside curly braces.