title: Find keys in nested array of objects
body: <p>I receive multiple JSONs from an API (17 API calls with <code>Promise.all()</code> ). For example</p>
  
  <pre><code>[
    {
      key: value,
      key: value,
      key: value,
      key: value,
      values: [
        {
          key: value,
          key: value,
          key: value,
          keyIWant: value
        }
        {
          key: value,
          key: value,
          key: value,
          keyIWant: value
        }
        {
          key: value,
          key: value,
          key: value,
          keyIWant: value
        }
      ]
    }
    {
      key: value,
      key: value,
      key: value,
      key: value,
      values: [
        {
          key: value,
          key: value,
          key: value,
          keyIWant: value
        }
        {
          key: value,
          key: value,
          key: value,
          keyIWant: value
        }
        {
          key: value,
          key: value,
          key: value,
          keyIWant: value
        }
      ]
    }
    {
      key: value,
      key: value,
      key: value,
      key: value,
      values: [
        {
          key: value,
          key: value,
          key: value,
          keyIWant: value
        }
        {
          key: value,
          key: value,
          key: value,
          keyIWant: value
        }
        {
          key: value,
          key: value,
          key: value,
          keyIWant: value
        }
      ]
    }
  ]
  </code></pre>
  
  <p>and I really have no idea to get the key I want (and to get it on a more generic approach). So far my attempts have been</p>
  
  <pre><code>static _findKey(nestedData) { 
      const result = [];
      const buffer = [];
      for (const prop in nestedData) {
          const value = nestedData[prop];
          if (typeof value === "object") {
              buffer.push(Class._findKey(value)); 
          }
          if (prop === "keyIWant") { // key would be an argument from the function if it'd worked 
               result.push(value);   // doesn't work because of recursive call?
          }
      }
      return result;
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>static _findKey(projects) { // 
      return projects.forEach(project =&gt; {
          return project.values.forEach(projectValue =&gt; {
              return projectValue.key;
          });
      });
  }
  </code></pre>
  
  <p>Do you have some more ideas? I'm still learning JavaScript and thus want a clean and comprehensive solution, but couldn't build one by myself.</p>