<html>
<head>
<title>Using the sort() method on numbers and strings</title>
<script type="text/javascript" language="javascript">
<!-- //
function SortElements() {
var myNums = new Array(9,4,"B",11,301);
myNums.sort();
var mj = myNums.join(", ");
alert("The sorted array contains: " + mj);
}
// -->
</script>
</head>
<body onload="SortElements()">
</body>
</html>
|