Last active
April 24, 2024 12:32
-
-
Save emersondemetrio/605d03561c0f85e07c2beec0d7bf2341 to your computer and use it in GitHub Desktop.
Fill array with something
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 2024 version | |
const arr = Array.from({ length: 30 }, (_, id) => ({ | |
id, | |
name: `item-${id}` | |
})); | |
// 2018 version | |
const arr = Array.from(Array(30), (_, id) => ({ | |
id, | |
name: `item-${id}` | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment