Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I use .sort() in jQuery? [closed]

Tags:

People also ask

Does sort return a new array?

The sort() method sorts the elements of an array in place and returns the reference to the same array, now sorted.

How do I sort a string array in jQuery?

The jQuery array sort() function is used to sorts the elements of the array. This function is a built-in function in jQuery. This function sorts the array of a number, string, and object in ascending and descending order.

How sort method works in JavaScript?

When the sort() function compares two values, it sends the values to the compare function, and sorts the values according to the returned (negative, zero, positive) value. If the result is negative a is sorted before b . If the result is positive b is sorted before a .


I've been looking at a lot of examples where people use the .sort() function in jQuery.

So for example:

$('#myId').sort(..); 

By I cannot find any documentation for sort() in the jQuery API, can anyone show me its usage?