Skip to main content

Create an array of consecutive numbers with spread operator.

// Create an array of consecutive numbers with spread operator

let arr = [...Array(7).keys()];

console.log(arr);