title: How to iterate a nested object using map function?
body: <p>I had used for loop to iterate nested objects, I am  trying to replace <code>forEach</code> with the <code>map</code> function, without success. Can anyone help me with this?</p>
  
  <p>schema.js</p>
  
  <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>const products_schema = {
  
      product_name: {
          auto: false,
          type: "string",
          min: 5,
          max: 10,
          special_characters: ['_', ' '],
          numbers: true,
          alphabet: true,
          required: true,
          correct: ""
      },
      product_image: {
          auto: false,
          type: "array:string",
          min: 0,
          max: 50,
          required: true
      }
  }
  
  const specification_schema = {
      brand: {
          auto: false,
          type: "string",
          min: 10,
          max: 50,
          special_characters: ['_', ' '],
          numbers: true,
          alphabet: true,
          required: true
      }
  }
  
  let schema = {
      products_schema:products_schema,
      specification_schema:specification_schema
  }
  for(var key in schema)
  {
      var value = schema[key]
      Object.keys(value).forEach(key =&gt; console.log(value[key].type));
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>"Expected output:"<br>
  string<br>
  array:string<br>
  string</p>