var protoarr = new Array, arr = [],a = 0; protoarr[1]=1 arr.__proto__= protoarr arr[4] = 4; arr[9] = 9; arr[8] = 9000; arr.forEach(function() { a++ }); alert(a)