News for hackers. Stuff that matters.
Re:Click by smoe on Friday March 19, 2021 @06:51PM (#26518980)
The other comment points out Array.from, which seems pretty nifty. Have not seen it before. I would have used:

  for(i of Array(1000).keys()) { doSomething() }
or

  [...Array(1000)].forEach(() => doSomething())
Re:Click by vardaro on Saturday March 20, 2021 @02:25AM (#26521211)
why create the array?

for(let i = 0; i < 1000; i++) button.click()

wouldn’t be surprised if Javascript has some weird optimization under the hood!

Re:Click by epse on Saturday March 20, 2021 @04:48AM (#26521703)
In this case, there's not much difference. In general, iterating over something rather than using a counter with limits makes it harder to create off by one or other errors due to laziness.