<!DOCTYPE html ><html ><head><meta charset="UTF-8"><title>数组的创建</title><script>var arr5=[{name:"李四",age:23,fun:function(){alert("哈哈");}},[3,4,5,new Object()],"hello",new Array("html","css","javascript")];arr5[0],fun()alert(arr5[1])alert(arr5[3][0]);</script></head><body></body></html>
3 回答
baleful
TA贡献19条经验 获得超7个赞
<!DOCTYPE html > <html > <head> <meta charset="UTF-8"> <title>数组的创建</title> <script> var arr5=[ { name:"李四", age:23, fun:function(){ alert("哈哈"); } }, [3,4,5,new Object()], "hello", new Array("html","css","javascript") ]; arr5[0].fun(); alert(arr5[1]); alert(arr5[3][0]); </script> </head> <body> </body> </html>
显现编码格式 为utf-8,
其次要注意标点符号,都是英文的
清水3201892
TA贡献2条经验 获得超0个赞
除了 逗号( , )用成中文逗号( , ),字符串外忘加引号 " " , 你的数组表达不清楚,
二维数组结构:var Myarr = [ [0 , 1 , 2 ] , [99, 88 , 77, ] ] ; //Myarr[0][1]=1
多维嵌套结构:
var arr=[
[
[1,2,3],[11,22,33]
],
[
['a','b','c'],[303,202,101],[1,0]
]
];
//arr[1][2][0]=1
只能 授人以渔了
添加回答
举报
0/150
提交
取消