> Array(clicks) instantiate an array of length 'clicks', with its elements undefined.
Not undefined elements but no elements, or "empty" elements.
> they could've just used Array(clicks).
No, because the following forEach call does nothing for such an array. You need to fill the array first with Array(clicks).fill() or shorter, [...Array(clicks)]
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
(In python there is the "*" operator which should be equivalent: [1, 2, *arr].
Array(clicks) instantiate an array of length 'clicks', with its elements undefined.
Then "[...Array(clicks)]" takes the above array instance and spreads it as content in another array.
Seems redundant and they could've just used Array(clicks).