3 ms·
Const is primarily for documentation to indicate that the assignment happens only once and won't be redefined. Using 'let' or 'var' indicates to the reader tha
by archgoon 7y ago
Const is primarily for documentation to indicate that the assignment happens only once and won't be redefined. Using 'let' or 'var' indicates to the reader that the variables value will be reassigned in the function.
It's not about the compiler.
- eterm 7y agoAlso let/const don't get hoisted to the start of the function, declaration using var does.