The lodash orderby method is one of several options in lodash for sorting collections mainly arrays. It works more or less the same way as the lodash sortby method, but it allows for setting the sort orders ( ascending or descending ) of each method that is used to sort the collection.
A Basic example of the lodash orderby method could just be passing an array of numbers as the first argument. That kind of example will work the same way as that as such a basic example using lodash sortby.
The second argument is used to give method that are used for sorting, and the third argument is used to set the ascending and descending order of the sorting though. So with that said another basic example the would showcase the difference of orderby compared to sortby would by to set null as the second argument, and then the string ‘desc’ for descending rather than the default ‘asc’ or ascending order.
So then order by is just a more robust version of lodash sortby that allows for setting the ascending or descending order of the resulting sort of the collection.