【发布时间】:2021-09-16 07:22:55
【问题描述】:
我还有其他类似的 JSON 数据,因此,我想对其进行过滤。
const data = [{
"1": {items: { Part1: true, Part2: true } },
id: "zaMR9TR7hNV3p3VFNumyNbXMto93",
displayName: name1
}]
但是,我不断收到错误
无法读取未定义的属性(读取“项目”)
const filter = data.filter(
(a) =>
a.["1"].items.Part1 == true
);
我该如何解决这个问题?
【问题讨论】:
标签: javascript reactjs json