Code to go logo
Created using Figma
Use Cases
Contribute
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]
Feb 27, 2024
1
Jad Joubran
See answer
1
Jad Joubran
Object.keys
on MDN
Learn JavaScript step by step