Skip to content

Instantly share code, notes, and snippets.

@Gummiees
Last active January 28, 2022 14:36
Show Gist options
  • Save Gummiees/c7ba3b3c2779e28a1ab65de1e0a5299f to your computer and use it in GitHub Desktop.
Save Gummiees/c7ba3b3c2779e28a1ab65de1e0a5299f to your computer and use it in GitHub Desktop.
Create a new array of defined length
// Create a new array of length X, that contains the index + 1 to the length.
const x = 10;
const numbers = new Array(x).fill(null).map((_,i)=> i + 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment