function writeDocument(variable){ document.write(variable+"<br/>") } var arr=["HTML","CSS","XXX"]; writeDocument(arr[2]); writeDocument(arr); //数组的赋值 arr[2]="HHH"; writeDocument(arr); arr[3]="XXX"; writeDocument(arr); arr[5]="ccc"; writeDocument(arr); arr[9]="yyy"; writeDocument(arr);