#ActuallyAutistic web dev. Does front of the front-end. Loves perf and minimalism. Prefers HTML, CSS, Web Standards over JS, UX over DX. Hates div disease.
This makes code easier for more people to understand. Also, using try ... catch and creation of new function for each iteration might hurt performance in tight loops. lodash implementation is both optimized for performance and has tests for edge cases.
For this purpose I'd recommend using what majority of devs use for this purpose: lodash.
This makes code easier for more people to understand. Also, using
try ... catch
and creation of new function for each iteration might hurt performance in tight loops. lodash implementation is both optimized for performance and has tests for edge cases.Just make sure to use the import like in the above. :)
I've unfortunately seen waaay to many projects include the entire lodash library for just one or two functions...
Or even worse for already poly-filled array methods.. :D