 <p>Since your tree is essentially an object array, where each object has a label and an optional child array, what you need to prune are array elements, either in the main tree array or in one of it's branches. </p> <p>You definitely do not want to use <code>delete</code> to delete array elements, since that leaves you with a sparse array. Instead, you should <code>splice</code> out array elements. </p> <p>You should, on the other hand, use <code>delete</code> to remove object properties, like <code>children</code> once they're empty. Here's the code I would use:</p> <pre><code>function prune(array, label) { for (var i = 0; i &lt; array.length; ++i) { var obj = array[i]; if (obj.label === label) { // splice out 1 element starting at position i array.splice(i, 1); return true; } if (obj.children) { if (prune(obj.children, label)) { if (obj.children.length === 0) { // delete children property when empty delete obj.children; // or, to delete this parent altogether // as a result of it having no more children // do this instead array.splice(i, 1); } return true; } } } } </code></pre> <p>Now assuming your tree was called <code>tree</code> and the label you wanted pruned was <code>node3</code>, you would call prune like so:</p> <pre><code>var wasItPruned = prune(tree, "node3"); </code></pre>