I got a problem when I was using the Array.prototype.forEach function.
here is my code, I'm wondering why the forEach function doesn't execute any loop step when an array is created by the Array constructor without initial value
var arr = new Array(3) //arr : [undefined, undefined, undefined]
arr.forEach(function(){
console.log('my code');
})//doesn't output the expected result
//this works well
for(var i = 0, length = arr.length; i < length; i++)
console.log('output the expected result')
//this case works well too.
var arr2 = new Array(undefined, undefined, undefined) // arr2: [undefined, undefined, undefined]
arr2.forEach(function(){
console.log('my code');
})//works well