3 ms·
> Array(clicks) instantiate an array of length 'clicks', with its elements undefined. Not undefined elements but no elements, or "empty" elements. > they coul
by tuukkah 4y ago
> 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)]