4 ms·
If that was the reason, then shouldn't "const" be as slow as "let"?
by ihuman 6y ago
If that was the reason, then shouldn't "const" be as slow as "let"?
- kjksf 6y agoIt 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).