title: Find elements with specific value in a nested array with unknown depth
body: <p>I have an array with objects for which the nesting depth is unknown and can be different. An example of such an array looks like that:</p>
  <pre><code>let exampleArray = [
    {
      id: 'some-id',
      label: &quot;Item 1&quot;,
      children: [
        {
          id: 'some-id',
          label: &quot;Child 1&quot;,
          children: [
            {
              id: 'some-id', // How to find this for example?
              label: &quot;Child 2&quot;,
              children: []
            }
          ]
        }
      ]
    },
    {
      id: 'some-id',
      label: &quot;Item 2&quot;,
      children: [
        {
          id: 'some-id',
          label: &quot;Child 1&quot;,
          children: [
            {
              id: 'some-id',
              label: &quot;Child 2&quot;,
              children: []
            }
          ]
        }
      ]
    }
  ]
  </code></pre>
  <p>Each array item can have a nested array <code>children</code>. The basic structure is the same as the parent one.</p>
  <p><strong>The challenge</strong></p>
  <p>When I for example want to delete a nested element with a specific id, how could I do this? I think it would not be the best practice to start iterations with a static number of loops, because I don't know how big the array is nested.</p>
  <p>If I know the ID from the children element, can I say something like: <strong>&quot;Iterate the entire array including all nesting and find the element with the ID xy?&quot;.</strong></p>
  <p>Or what would be the best practice to handle such nested arrays?</p>