DEV Community

Discussion on: Why you should use Array.some instead of 'for' loop or forEach?

Collapse
 
jwhenry3 profile image
Justin Henry

We should also be talking about, not only performance, but blocking. Regardless the function or mechanism you use to iterate, you should give thought to how many records you are cycling through and how much that impacts the rendering of the DOM.

If you find yourself iterating over thousands of records to perform an operation, you can use something like rxjs or some promise based iteration to work around that.

We should stop caring so much on which function you use for iteration, and care more about the implications for the application as a whole. Performance is great up until that performance still heavily blocks the application.