object.fromEntries

64 阅读1分钟

object.fromEntries

二维数组转换为对象

object.entries是逆运算 对象转换为二维数组

const result=object.fromEntries([
['name','尚硅谷'],
['xueke','java,大数据,前端,云计算']
])

const m=new map();
m.set('name','atguigu');
const result=object.fromEntries(m)