title: What is the proper term for recursively processing or "spidering" a JavaScript object with unknown keys?
body: <p>As a mostly self-taught programmer, when I first learned Perl subroutines (like <em>functions</em> in other languages), it was common to write this kind of statement:</p>
  <pre><code>sub someFunction(@args) {
     (el_1, el2, el3) = @args;
  }
  </code></pre>
  <p>I had been doing this procedure for years to essentially explode an array of function arguments into named variables. But, I don't remember it having a name. I just found out yesterday it was called &quot;<em><strong>destructuring</strong></em>&quot;. That is a technical, search-friendly term that will get many results when you are researching coding principles.</p>
  <p>Another example of a technical, search-friendly term is &quot;<em><strong>nullish coalescing operator</strong></em>&quot;. I have no idea what that even is, but it seems like a good example of something a self-taught programmer without a bachelors degree might not automatically know, unless specifically taught it.</p>
  <p>In much the same way, I am wanting to know what the technical, search-friendly term for
  <em><strong>recursively processing or &quot;spidering&quot; a JavaScript object with unknown/variable keys, that has objects or arrays nested on many levels?</strong></em></p>
  <h2>WHAT I'VE TRIED:</h2>
  <p>So far searches like these have been minimally fruitful:</p>
  <pre><code>how to parse nested javascript object?
  
  ES6 get properties of json object
  
  spider nested javascript objects with variable unknown keys
  </code></pre>
  <p>One Stack Overflow post that I found promising was this one:</p>
  <p><a href="https://stackoverflow.com/questions/11922383/how-can-i-access-and-process-nested-objects-arrays-or-json/11922384#11922384">How can I access and process nested objects, arrays or JSON?</a></p>
  <p>Near the very end of user <a href="https://stackoverflow.com/users/218196">@FelixKling</a>'s excellent answer, he describes what I'm talking about, without giving any kind of terminology for it, as thus:</p>
  <blockquote>
  <p>A more generic way to access a nested data structure with unknown keys and depth is to test the type of the value and act accordingly.</p>
  <p>Here is an example which adds all primitive values inside a nested data structure into an array (assuming it does not contain any functions). If we encounter an object (or array) we simply call toArray again on that value (recursive call).</p>
  </blockquote>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function toArray(obj) {
      const result = [];
      for (const prop in obj) {
          const value = obj[prop];
          if (typeof value === 'object') {
              result.push(toArray(value)); // &lt;- recursive call
          }
          else {
              result.push(value);
          }
      }
      return result;
  }</code></pre>
  </div>
  </div>
  </p>