Remove object from array of objects

前端 未结 9 1488
滥情空心
滥情空心 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:45

    Try:

    var ar = [{"value":"14","label":"7"},{"value":"14","label":"7"},{"value":"18","label":"7"}];
    
    for(var i=0; i < ar.length; i++) {
       if(ar[i].value == "14" && ar[i].label == "7")
       {
          ar.splice(i,1);
       }
    }
    

    demo

提交回复
热议问题