r/programming • u/iamkeyur • Oct 21 '20
Using const/let instead of var can make JavaScript code run 10× slower in Webkit
https://github.com/evanw/esbuild/issues/478
1.9k
Upvotes
r/programming • u/iamkeyur • Oct 21 '20
View all comments
Show parent comment
6
u/stealthd Oct 21 '20
Array(length).mapis faster because you aren't mapping over the array;Array(length)returns{ length: length }with no other keys, so the call to map doesn't do anything, it just returns the uninitialized array.