Remove object from array of objects

前端 未结 9 1443
滥情空心
滥情空心 2021-01-31 15:28

I have an array of objects:

[{\"value\":\"14\",\"label\":\"7\"},{\"value\":\"14\",\"label\":\"7\"},{\"value\":\"18\",\"label\":\"7\"}]

How I ca

9条回答
  •  鱼传尺愫
    2021-01-31 15:46

    Using ES6 approach:

    const objIndex = objs.findIndex(o => o.value === '14' && o.label === '7')
    
    if(objIndex > -1) {
      objs.slice(objIndex, 1)
    }
    

提交回复
热议问题