News for hackers. Stuff that matters.
Re:Using const/let instead of var can make JavaScript code r... by ihuman on Wednesday October 21, 2020 @01:37AM (#24845042)
If that was the reason, then shouldn't "const" be as slow as "let"?
Re:Using const/let instead of var can make JavaScript code r... by kjksf on Wednesday October 21, 2020 @02:08AM (#24845181)
It should be valid to move `const` outside of the loop, since by definition it cannot be changed.

`let` can be changed so cannot be optimized out this way (at least not without doing more complex analysis and proving that the variable is not being changed).