title: JavaScript - check if object's property is an array
body: <p>I have the following object:</p>
  
  <pre><code>const foo = {
     prop1: 'I am a string',
     prop2: [
             { prop2_1: 'I am a sub string' },
             { prop2_2: 'I am a sub string' },
     ],
     prop3: 'I am a string',
     prop4: [
             { prop4_1: 'I am a sub string' },
             { prop4_2: 'I am a sub string' },
     ],
  }
  </code></pre>
  
  <p>In JavaScript (ie not jQuery), how can I loop thru foo's properties and determine if any of it's properties are arrays? I tried this with no luck:</p>
  
  <pre><code>for (const prop in foo) {
    if (prop!== undefined) {
      if (Object.prototype.toString.call(prop) === '[object Array]') {
        prop.map((child) =&gt; {
            // do something
        });
      }
    }
  }
  </code></pre>