//--声明数组,并赋值
var names = ['徐伯涵', '毛球', '王大力'];
console.log(names.length);
for (var i = 0; i < names.length; i++) {
console.log(names[i]);
}
console.log(names.toString());
//声明各种类型数组
var data = ['孙琳', new Date(), 12, null, function () { alert('我是方法'); }, true, [1, 2, 3]];
console.log(data.length);
alert(data[1]);
data[4]();
alert(data.toString());
//声明空数组后追加数据
var arry = [];
arry[0] = '王大力';
arry[1] = 18;
console.log('arry数组的长度' + arry.length);
console.log(arry.toString());
JavaScript笔记-数组
猜你喜欢
转载自blog.csdn.net/BowenXu11/article/details/105025064
今日推荐
周排行