【发布时间】:2020-04-28 21:28:10
【问题描述】:
我对对象有疑问。我想filter 返回键列表在下面的这个对象中条件为真:
myObject = {
key1: {
name:"key1",
select:true
},
key2: {
name:"key2",
select:false
},
key3: {
name:"key3",
select:true
}
}
出于某种原因,我必须为其添加特定的密钥。现在我想返回一个数组有 seclect true。
arrayWantreturn = ["key1", "key3"]
非常感谢您的帮助。
【问题讨论】:
标签: javascript arrays object ecmascript-6 filter