<html>
<head>
<title>Using the sort() method</title>
<script type="text/javascript" language="javascript">
<!-- //
function SortElements(){
var colors = new Array("red","blue","green");
colors.sort();
var cj = colors.join(", ");
alert("The sorted array contains: " + cj);
}
// -->
</script>
</head>
<body onload="SortElements()">
</body>
</html>
|