What is array sort in JavaScript
In this article I am going to explain array sort method of JavaScript.
Array sort method in JavaScript
It sorts the elements of an array.
Syntax of array sort method
Parameters in some method:
Return value of sort method
It returns a sorted array.
Example of sort function
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Array Sort Method</title>
</head>
<body>
<script type="text/javascript">
var a = ['c','d','a','k'];
a.sort();
alert(a);
</script>
</body>
</html>
|
Output:
Ask Your Question
Got a programming related question? You may want to post your question here