Move the var definition inside the for (var i ... 
more concise code.