This topic created in 3515 days ago, the information mentioned may be changed or developed.
var a = ["name","age","sex"];
var b = ["lisi",18,"man"];
var arr = new Array();
for(var i = 0; i < a.length; i++) {
arr[a[i]] = b[i];
}
console.log(arr);
3 replies 2016-10-18 22:58:50 +08:00  | | 1 prefere Oct 18, 2016 Array 是个对象吧, alert(arr) |
 | | 2 wssgcg1213 Oct 18, 2016 数组的本质是对象,它的原型链:[] -> Array.prototype -> Object.prototype |
 | | 3 ianva Oct 18, 2016 对象也能作为数组用,所以对象可以当关联数组也可以当数组用 比如: var a = {}; Array.prototype.push.call( a,11); console.log( a.length ) // 你会发现会有了 length 属性并为 1 a 就成了一个类数组 |