我正在寻找一种将 2 个数组合并为文字对象的原生 JavaScript 方法。
转这个:
var x = ["blue", "yellow", "red", "green", "brown", "grey", "gray", "orange"];
var y = ["james", "john", "robert", "michael", "william", "david", "richard", "wayne"];
进入这个:
{
"obj" : {
"blue" : "james",
"yellow" : "john",
"red" : "robert",
"green" : "michael",
"brown" : "william",
"gray" : "david",
"grey" : "richard",
"orange" : "wayne"
}
}