Edit in JSFiddle

let arr = [...Array(10).keys()]
console.log('new array',arr);