92
JavaScript TypedArray sort() Method
The JavaScript sort() method is used to sort the array and returns the updated array. The array can be any type like- string, numbers, and character.
Syntax:
Parameters:
No parameters.
Return value:
The sorted array.
Browser Support:
Chrome | Yes |
Safari | Yes |
Firefox | Yes |
Opera | Yes |
Example 1
JavaScript TypedArray sort() Method.
Output:
1,2,4,5,8
Example 2
JavaScript TypedArray sort() Method.
Output:
4,1,8,5,2
Example 3
JavaScript TypedArray sort() Method.
Output:
8,5,4,2,1
Example 4
JavaScript TypedArray sort() Method.
Output:
1,2,4,5,8
Next TopicJavaScript TypedArray Object