filter object by key and its items

前端 未结 2 1386
猫巷女王i
猫巷女王i 2021-01-20 21:17

I have an object that I would like to filter it\'s keys..

Im trying to filter the object by an ID, like so:

let myKeys = Object.keys(data).filter(fun         


        
2条回答
  •  鱼传尺愫
    2021-01-20 21:32

    If you have the proper key(s), you can just get the property from the object.

    myKeys.forEach(key => {
       console.log(data[key]);
    });
    

    This will print the object whose keys you've filtered earlier.

提交回复
热议问题