sort() is an array function from Node.js that is used to sort a given array.
Parameter: This function does not takes any parameter.
Return type: The function returns the sorted array.
The program below demonstrates the working of the function:
[ 1, 1, 2, 3, 5, 8 ]
[ -3, 1, 1, 10, 12 ]
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.