Using let we can avoid hoisting.
As a general rule, use let only for loop counters or only if you really need reassignment. Everywhere else, use const. Personally I’ve ditched loops for filter(), map() & reduce(). You should too.
https://medium.freecodecamp.org/what-is-variable-hoisting-differentiating-between-var-let-and-const-in-es6-f1a70bb43d
No comments:
Post a Comment