title: Javascript: Array length stays 0 when adding items
body: <p>So I have the following code and I check if a key exists in the array. if not I create it and then I push items in it. Everything works except that the length of the main array is always 0.</p>
  
  <pre><code>if(typeof this.markerList[this.lastClicked] === 'undefined'){
      this.markerList[this.lastClicked] = [];
  }
  this.markerList[this.lastClicked].push(marker);
  </code></pre>
  
  <p>result of a console.log:</p>
  
  <p><img src="https://i.stack.imgur.com/gK7kl.png" alt="enter image description here"></p>