title: how to delete specific object from nested array of objects recursively?
body: <p>data :</p>
  
  <pre><code>    var data = [ 
     { 
        "name":"list1",
        "type":"list",
        "id":1,
        "child":[ 
           { 
              "name":"list2",
              "type":"subList",
              "id":2,
              "child":[ 
                 { 
                    "name":"list3",
                    "type":"subList",
                    "id":3
                 },
                 { 
                    "name":"list4",
                    "type":"list",
                    "id":4,
                    "child":[ 
                       { 
                          "name":"list5",
                          "type":"list",
                          "id":5
                       }
                    ]
                 }
              ]
           },
           { 
              "name":"list6",
              "type":"subList",
              "id":6
           }
        ]
     },
     { 
        "name":"list I",
        "type":"list",
        "id":7
     }
  ]
  </code></pre>
  
  <p>I need to remove <strong>"id": 5</strong> form this data, I tried this :</p>
  
  <pre><code>data.filter(function f(o) {
    return o.id !== 5 ||
           o.child &amp;&amp; (o.child.filter(f)).length
  })
  </code></pre>
  
  <p>Final output would be without id:5, In some cases the first list id:1 also can be erasable. Hot to simplify this recursively It may have N no of children list, have to loop through every list and delete it?</p>