3 ms·
This is why I hate JS Array#sort. Its return type being an array gives the impression it’s not sorting the original array, leading to a lot of hard to track dow
by eyelidlessness 5y ago
This is why I hate JS Array#sort. Its return type being an array gives the impression it’s not sorting the original array, leading to a lot of hard to track down bugs.
It’s also one of the biggest reasons I discourage use of lodash. Sure, most of its methods are pure and return new values. But some do mutate the input, and they’re interchainable (sorry, couldn’t resist). The only way to know which you’re using is to memorize or constantly consult their enormous API.