title: Find the value inside the array of objects that include children from the array of objects
body: <p>I have array of objects that include children from the array of objects and i need to find value inside parent array or find value inside childrens of this array etc. Maybe recursive. I trided like this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var array = [
    {
      id: 1,
      value: 'value',
      children: null
    },
    {
      id: 2,
      value: 'my value',
      children: [
        {
          id: 'child1',
          value: 'my value',
          children: null
        },
        {
          id: 'child2',
          value: 'value',
          children: null
        },
        {
          id: 'child3',
          value: 'value,
          children: [
            {
              id: 'childchild1',
              value: 'my value',
              children: null
            }
          ]
        }
      ]
    },
    {
      id: 3,
      value: 'value',
      children: null
    },
    {
      id: 4,
      value: 'my value',
      children: null
    }
  ]
  
  
  function find(searchData, target){
    return target.filter((f)=&gt;{
      if(f.value.includes(searchData)){
        return true
      }
      if(f.children){
        return find(searchData, f.children)
      }
    })
  }
  
  find('my', array)</code></pre>
  </div>
  </div>
  </p>
  
  <p>It's returns source array but i need array which includes text 'my'</p>