title: javascript find by value deep in a nested object/array
body: <p><strong>hello</strong> , I have a problem returning an object in my function, Let's say I have an object:</p>
  
  <pre><code>var elements = [{
      "fields": null,
      "id_base": "nv_container",
      "icon": "layout",
      "name": "container",
      "is_container": true,
      "elements" : [
          //another elements set here
      ]
  }, 
  {
      "id_base": "novo_example_elementsec",
      "name": "hello",
      "icon": "edit",
      "view": {}
  }];
  </code></pre>
  
  <p>what i want is a function (in pure javascript) that can find an object with a specific key and value , and i have created a function but its just not working fine ? , my function :</p>
  
  <pre><code>function findNested(obj, key, value) {
      //Early return
      if (obj[key] === value) {
          console.log( 'before return' ); //until here . its fine
          return obj; //not working
      } else {
          for (var i = 0, len = Object.keys(obj).length; i &lt;= len; i++) {
              if (typeof obj[i] == 'object') {
                  this.findNested(obj[i] , key, value);
              }
          }
      }
  }
  </code></pre>
  
  <p>I just can't see what I've done wrong ?<br/><br/>
  thanks.</p>