Searching for items in a JSON array Using Node (preferably without iteration)

后端 未结 6 919
孤城傲影
孤城傲影 2020-12-16 03:06

Currently I get back a JSON response like this...

{items:[
  {itemId:1,isRight:0},
  {itemId:2,isRight:1},
  {itemId:3,isRight:0}
]}

I want

6条回答
  •  渐次进展
    2020-12-16 03:42

    Since Node implements the EcmaScript 5 specification, you can use Array#filter on obj.items.

提交回复
热议问题