cachaito
4/1/2015 - 8:00 PM

For loop curious examples

//1
var i = 0; 
var len = arr.length;
var arr = [1,2,3,4,5]; 

for(; i < len; i++) {
  console.log(arr[i]);
}

//2
for(var arr = [1,2,3,4,5], i = 0, len = arr.length; i < len; i++) {
  console.log(arr[i]);
}