title: JavaScript array length issue
body: <p>I'm a bit lost with the following:</p>
  
  <p>When I do a console.log of two different arrays, one is giving me the actual length but not the other.</p>
  
  <p>Output of first array, with good length:</p>
  
  <pre><code>[Object, Object, Object]
    0: Object
    1: Object
    2: Object
    length: 3
    __proto__: Array[0]
  </code></pre>
  
  <p>Output of the second one, length should be 4 but is actually 0:</p>
  
  <pre><code>[A: Object, B: Object, C: Object, D: Object]
    A: Object
    B: Object
    C: Object
    D: Object
    length: 0
    __proto__: Array[0]
  </code></pre>
  
  <p>Why do my first array do have a correct length, but not the second one ?</p>
  
  <p><strong>Edit</strong>:
  this is the code generating the above output:</p>
  
  <pre><code>var links = [
    {source: "A", target: "B"},
    {source: "A", target: "C"},
    {source: "A", target: "D"}
  ];
  
  var nodes = [];
  
  // Compute the distinct nodes from the links.
  links.forEach(function(link) {
    link.source = nodes[link.source] || (nodes[link.source] = {name: link.source});
    link.target = nodes[link.target] || (nodes[link.target] = {name: link.target});
  });
  
  console.log(links);
  console.log(nodes);
  </code></pre>