let obj = ["x","y","z"];
let objTmp = {};
Array.from(obj,(o)=>{
console.log(o+1);
}); //x1,y1,z1我想得到如下形式:{x1:'', y1:"",z1:''}, 但不行,How? let obj = ["x","y","z"];
let objTmp = {};
Array.from(obj,(o)=>{
Object.assign(objTmp, o+1);
});
console.log( objTmp); //{"0":z, "1":1}
添加回答
举报
0/150
提交
取消