Is this true:
Statements or assignments that can be placed outside the loop will make the loop run faster.
Bad:
var i; for (i = 0; i < arr.length; i++) {
Better Code:
var i; var l = arr.length; for (i = 0; i < l; i++) {
https://www.w3schools.com/js/js_performance.asp
Update:
What is the purpose of declaring i before the loop?