The following code:
let myArray = Array.apply(null, {length: 10}).map(Number.call, Number);
Creates the following Array:
[0, 1,
es6 simpliedfied version
let k = Array.from({ length: 5 }).map((currentElement, i) => i) console.log(k) // Output -[0, 1, 2, 3, 4]