0

我想为具有特定键的数组分配一个常量。

"main": [
    {
        "1": [
            {
                "[\"test\"]": {},
                "[\"match\"]": {}
            }
        ]
    },
    {
        "2": [
            {
                "[\"test\"]": {},
                "[\"match\"]": {}
            }
        ]
    }
]

我试过这种方式,但没有帮助

 const dates = main.filter(main.key === info.key);

请告诉我如何做到这一点?我是否正确理解 main 中的“1”和“2”是键?

非常感谢!

4

0 回答 0