<html>
<head>
<title>Using the slice() method of the Array object</title>
<script type="text/javascript" language="javascript">
<!-- //
function f(){
var allNames = new Array("A", "B", "C", "D", "E");
var firstB = 1;
var firstNonB = 2;
var bNames = allNames.slice(firstB, firstNonB);
var an = allNames.join(", ");
var bn = bNames.join(", ");
alert(an);
alert(bn);
}
// -->
</script>
</head>
<body onload="f()">
</body>
</html>
|