//数组转换成对象
const arr = [['foo', 1],['bar', 2]]
const obj = Object.fromEntries(arr)
console.log(obj.bar)
//找出key的长度为3的值
const obj = {
abc: 1,
def: 2,
ghewe: 3
}
let res = Object.fromEntries(
Object.entries(obj).filter(([key, val]) => key.length === 3)
)
console.log(res)
来源:https://www.cnblogs.com/qjb2404/p/12232278.html