HTML
HEAD
TITLE New Document /TITLE
META NAME="Generator" CONTENT="EditPlus"
META NAME="Author" CONTENT=""
META NAME="Keywords" CONTENT=""
META NAME="Description" CONTENT=""
/HEAD
BODY
数组和其slice()方法的使用
SCRIPT LANGUAGE="JavaScript"
!--
var firstArray = new Array();
firstArray[0]="0";
firstArray[1]="1";
firstArray[2]="2";
firstArray[3]="3";
firstArray[4]="4";
for(var i=0 ; ifirstArray.length;i++){
document.write("firstArray["+i+"]="+i+"br/");
}
var firstArray = firstArray.slice(0,3);
document.write(firstArray);
//--
/SCRIPT
/BODY
/HTML
演示效果如下:
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]