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:

ChromeYes
SafariYes
FirefoxYes
OperaYes

Example 1

JavaScript TypedArray sort() Method.

Test it Now

Output:

1,2,4,5,8

Example 2

JavaScript TypedArray sort() Method.

Test it Now

Output:

4,1,8,5,2

Example 3

JavaScript TypedArray sort() Method.

Test it Now

Output:

8,5,4,2,1

Example 4

JavaScript TypedArray sort() Method.

Test it Now

Output:

1,2,4,5,8





Latest Courses