This is an overly clever way to generate a range of numbers, which is something better built in to other programming languages.
To break it down, we'll assume a product.countInStock value of 5:
Array(5) creates a new array using the Array constructor of length 5, note that this just sets the length, and leaves all the values as empty.
Chrome even logs this as [empty × 5]
Calling .keys() returns an iterator, which lets you iterate over the key values.
Important thing at this step is it doesn't return an actual array, you have to spread or loop over the iterator to get the values.
The spreading is done with the [...iterator] piece, the result of [...Array(5).keys()] evaluates to [0,1,2,3,4], and from there it can be treated as a normal array with calls like map.
This Stack Overflow answer goes over it more and has some alternatives.