Lodash is a module in Node.js that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc. The Loadsh.sortBy() function is used to sort the array in ascending order.
Parameters: This parameter holds the collection as a first parameter, Second parameter is optional. The second parameter is basically a function that tells how to sort.
Return Value: It returns the sorted collection.
Note: Please install lodash module by npm install lodash before using the below given code.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.