//创建一个数组
var arr = [1,2,'asd','posh0','2',1];
//创建一个空的对象
var arr2 = {};
for (var i = 0; i < arr.length; i++) {
arr2[i]=arr[i];
}
console.log(arr2);
//遍历数组
for(var i in arr2){
console.log(arr2[i]);
}
//创建一个数组
var arr = [1,2,'asd','posh0','2',1];
//创建一个空的对象
var arr2 = {};
for (var i = 0; i < arr.length; i++) {
arr2[i]=arr[i];
}
console.log(arr2);
//遍历数组
for(var i in arr2){
console.log(arr2[i]);
}