Javascript Sort() Function

The sort() function of array object sorts the elements of an array. Use it for example to sort element of existing array.

Syntax

Javascript Sort() Function Example1

This will produce following result

Javascript Sort() Function Example2

This will produce following result