Can save more bits by doing:
Array.from({ length: 10000 }, button.click);
Array.from({ length: 10000 }, button.click);
But your approach makes perfect sense and is so much cleaner. Thank you!
If anyone is wondering why it works, it's because everything in JavaScript is an object. So, an array is an object with a length prop. Apparently Array.from just needs any object with a length prop to work
Similarly, when I pick up a feathered pen in real life I become a duck
Well, .duck isn't a TLD yet and it may not be publicly available...
[...new Array(1000)].map(something)
[...Array(1000)]
I think that is the least bits. Would love to be proven wrong :D
That's what I like in the elegance of Array.from({ length: 1000 }): it's a hack, but it reads naturally.