0% found this document useful (0 votes)
14 views

Sorting of An Array

This document demonstrates sorting an array in JavaScript. It defines an array with 5 integer elements, prints the original unsorted array, uses the sort() method to sort the array, and then prints the sorted array.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Sorting of An Array

This document demonstrates sorting an array in JavaScript. It defines an array with 5 integer elements, prints the original unsorted array, uses the sort() method to sort the array, and then prints the sorted array.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

SORTING OF AN ARRAY

<html> <head> <script type="text/javascript"> var a=new Array(8,4,2,6,0); document.writeln("array:"+a+"<br>") a.sort() document.writeln("array:"+a) </script></head> </html>

OUTPUT

You might also like