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}
相关分类