How to create a range array in JavaScript

Arrays
By Jad Joubran · 
Last updated Feb 27, 2024
// Create a range from 0 to 4
[...Array(5).keys()];
[0, 1, 2, 3, 4]
Object.keys on MDN