var arrA = [‘weibo’, ‘work’]
var arrB = [{index_template: ‘1’, count: 10, scroll_play_pic: ‘0’},{index_template: ‘2’, count: 20, scroll_play_pic: ‘2’}]
var info = {};
function ArrayToObj(arrA, arrB) {for(var i = 0; i < arrA.length; i++) {info[arrA[i]] = arrB[i];
}
return info;
}
ArrayToObj(arrA, arrB);
console.log(info);
for(var key in info){console.log(key+':'+info[key])
}
最终后果