I am confused by Array.apply behaviour when using it to create an array.
See the following code:
Array.apply(null, { length: 6 })
Array.apply(null,new Array(6))
Both output [undefined, undefined, undefined, undefined, undefined, undefined] which is as you would expect, an array of 6 elements. On the other hand if you use the following snippet:
Array.apply(null, [6])
In this one the output is [undefined × 6] which does not make any sense.
Does anyone have a explanation for this behaviour?