The arrow function that you set is stopped because the filter returns only elements that are undefined, but none of your elements are undefined, so the result is an empty array. But I think I know where you are confused.
array[10] = 10
does not specify the length of the array. It sets a specific element to 10. So, after this line, you have an array with 4 elements: 1, 2, 3 and ... 10.
In an array, you can set the index for a specific value. If you omit it, it will just add 1 to the last index. Try the following:
var array = [1, 2, 3]; array[10] = 10; array.forEach( (value, index) => console.log(value, index));
JSFiddle: https://jsfiddle.net/eetmkd95/1/
you will see that it prints this:
1 0 2 1 3 2 10 10
why? because if you do not specify an index, it will generate one based on +1 increments, if you specify, it will put your value in that index. But you specify INDEX, not length. Now try the following:
var array = [1, 2, 3]; array.length = 10; array[8] = 10; array.forEach( (value, ix) => console.log(value, ix)); console.log(array.length);
How can it be? the length property reports 10, and forEach prints only 4 lines? that since a) forEach only shows elements that are actually present in the array and have numeric indices, and b) the length is not very reliable. It works only for numeric indices and only if you do not set it to a higher value (it works if you set it to a lower value). Also it does not work if you use strings as indexes. For instance:
var array = [1, 2, 3]; array['myString'] = 10; array.forEach( (value, ix) => console.log(value, ix)); console.log(array.length);
prints:
1 0 2 1 3 2 3
hope i clarified a bit :)
You can understand this in detail in the Kyle Simpson series of excellent books "You Don't Know JS". The part that talks about this is in the book Types and Grammar, page 44, entitled "Array (..)"
It may also be useful: http://www.2ality.com/2012/06/dense-arrays.html