title: How to access array within an object within an array?
body: <p>I have both an object and an array:</p>
  
  <pre><code>var elementsArr = [];
  var elements = {
      polygon: 734,
      infoContent: "huhu",
      id: 0
  }
  </code></pre>
  
  <p>I am going to have multiple "elements" and push each one into "elementsArr".</p>
  
  <pre><code>for(var i=0; i&lt;20; i++){
     elements.id = id +=1;
     elementsArr.push(elements);
  }
  </code></pre>
  
  <p>My problem now is how to access a specific "id" within the object elements, within the array elementsArr and pushing this into another array.</p>
  
  <p>I tried this but it doesn't seem to be working:</p>
  
  <pre><code>var ids = [];
  for(var m=0; m&lt;elementsArr.length; m++){
                  if(elements.id == elementsArr[m]){
                  ids.push(elements.id);
                  }
  </code></pre>
  
  <p>How do I do this?</p>