title: NodeJS Difference Object.keys(array).length and array.length
body: <p>I have a function which reads Files from the file system and stores them into an array. Afterwards I want to add a key/value pair to that element. However, the forEach loop is not executed, because apparently there is no element in there.</p>
  
  <pre><code>readFilesFromDirectory(folder, elements, 'json', function(){
      log(Object.keys(elements).length,0);
      log(elements.length,0);
      elements.forEach(function(elem){
          elem["newKey"] = 1;
      });
  });
  </code></pre>
  
  <p>My log contains the following lines:</p>
  
  <pre><code>1
  0
  </code></pre>
  
  <p>The first length method is working, the second is not.
  I would like to know what I am doing wrong for the second function and how I can fix it.</p>
  
  <p>Actually, my main objective is to add the new key. However, I do not know how to use some Object.keyValues(elements).forEach(function(elem){...} in my code. If you have a hint for that, this would also be nice.</p>
  
  <p>I would really appreciate some insight here! :-)</p>