You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I haven't comprehensively looked over the list of alternatives, but just as an example, one of the listed alternatives to _.last(numbers) is:
[].concat(numbers).pop()
It is even listed twice since it "works with undefined/null":
// Native (works even with potentially undefined/null)[].concat(undefined).pop()
While this code is certainly clever, it's also slow. It creates an entire copy of the source array in memory, and if someone uses this code in a loop, it could easily go quadratic.
I believe that code like this which "prematurely pessimizes" common operations should not be listed as an example.
The text was updated successfully, but these errors were encountered:
I haven't comprehensively looked over the list of alternatives, but just as an example, one of the listed alternatives to
_.last(numbers)
is:It is even listed twice since it "works with undefined/null":
While this code is certainly clever, it's also slow. It creates an entire copy of the source array in memory, and if someone uses this code in a loop, it could easily go quadratic.
I believe that code like this which "prematurely pessimizes" common operations should not be listed as an example.
The text was updated successfully, but these errors were encountered: