Sort

Sort Function in JavaScript Arrays

The sort function in JavaScript Arrays allows performs sorting of array elements. Like all of JavaScript this function is remarkably flexible as well. Let us say we want to sort an array. var a=Array(4,5,3,-2); To sort you call a.sort(); This will sort the array numerically. -2,3,4,5 To change the sorting mode we…