generateItems
Generates an array with the given amount of items, using the given function.
- Use
Array.from()
to create an empty array of the specific length, callingfn
with the index of each newly created element. - The callback takes one argument - the index of each element.