title: Iterate through an object which has nested objects in nodeJs
body: <p>I have a javascript object with multiple nested objects like this : </p>
  
  <pre><code> var stats = {
       bookServed: {
           redis: 90,
           s3: 90,
           signedUrl: 70
       },
       errors: {
           redis: {
               bookService: 70,
               mapi: 50,
               capi: 30
           },
           AWS: {
               signedUrl: 70,
               downloadBook: 50,
               searchBook: 10
           },
           decryption: 60
       }
   };
  </code></pre>
  
  <p>What would be the cleanest way to iterate through all its properties and set each value to <code>0</code> for instance. I wrote something like this </p>
  
  <pre><code> for (var property in stats) {
       if (stats.hasOwnProperty(property)) {
           if (typeof property === "object") {
               for (var sub_property in property)
                   if (property.hasOwnProperty(sub_property)) {
                       sub_property = 0
                   }
           } else {
               property = 0;
           }
       }
   }
  </code></pre>
  
  <p>I'm willing to use a library like underscore.js to do the task properly. </p>