Join elements in an array : Join « Array « JavaScript Tutorial






<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>








11.17.Join
11.17.1.Array.join()
11.17.2.Join elements in an array
11.17.3.Seeming success in copying an array