In JavaScript, due to historical reasons, the function keyword is not very strict. You can declare the same function using the same name, and the runtime will simply use the last definition. On top of that, function is hoisted.
let addresses both of of these points. Though best would be using const.
View all comments
Show parent comment
17
u/Bronzdragon Jul 19 '21
In JavaScript, due to historical reasons, the function keyword is not very strict. You can declare the same function using the same name, and the runtime will simply use the last definition. On top of that,
functionis hoisted.letaddresses both of of these points. Though best would be usingconst.