You can use the spread operator on the keys of a freshly created array [...Array(n).keys()]
console.log([...Array(6).keys()]) console.log([...Array(2).keys()]) // or console.log(Array.from(Array(6).keys(), i => i+1)); console.log(Array.from(Array(2).keys(), i => i+1));