代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script> var arr=[]; console.log(typeof (arr)); var arr1=[1,2,3,4,5]; console.log(arr1); console.log("arr1的元素个数是:"+arr1.length); arr1.length=0; console.log(arr1); var arr2=["lin1","lin2","lin3","lin4"]; console.log(arr2[0]); for(var i=0;i<arr2.length;i++){ console.log(arr2[i]); } arr2[0]="linzi1"; console.log(arr2[0]); arr2[4]="lin5"; console.log(arr2); console.log(arr2.pop()); console.log(arr2); arr2.push("linzi4"); console.log(arr2); arr2.splice(0,2,'xiaolinzi'); console.log(arr2); </script> </body> </html>