Remove element from multidimensional array

后端 未结 6 1712
情歌与酒
情歌与酒 2021-01-13 06:10

I have following multidimensional array:

{\"2\":{\"cid\":\"2\",\"uid\":\"2\"},\"1\":{\"cid\":\"1\",\"uid\":\"3\"}}

In this example i want t

6条回答
  •  孤城傲影
    2021-01-13 06:59

    You could use delete in javascript Ex:

    var x = {"2":{"cid":"2","uid":"2"},"1":{"cid":"1","uid":"3"}};
    
    delete x['1'];
    

    Also, check this:

    Deleting Objects in JavaScript

提交回复
热议问题