- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHPPhysics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
TypedArray.sort() function in JavaScript
The sort() method of the Typed Array object arranges the elements of the array in ascending order and returns it.
Syntax
Its Syntax is as follows
arrayBuffer.sort()
Example
<html>
<head>
<title>JavaScript Array every Method</title>
</head>
<body>
<script type="text/javascript">
var typedArray = new Int32Array([11, 5, 13, 4, 15, 3, 17, 2, 19, 8 ]);
document.write("Contents of the typed array: "+typedArray);
document.write("<br>");
var resultantArray = typedArray.sort();
document.write("Resultant Array: "+resultantArray);
</script>
</body>
</html>
Output
Contents of the typed array: 11,5,13,4,15,3,17,2,19,8 Resultant Array: 2,3,4,5,8,11,13,15,17,19
Advertisements