title: Javascript - Pulling specific objects out of an array
body: <p>New to coding &amp; learning javascript &amp; node.js. I have an array of 50 image results here: <a href="http://mistakes.io/#6204f3edd56b8891075d" rel="nofollow noreferrer">http://mistakes.io/#6204f3edd56b8891075d</a></p>
  
  <p>I am trying to pull out two specific objects in that array: "MediaUrl" and "SourceUrl".</p>
  
  <p>I can pull out an individual result via <code>body.d.results[15].MediaUrl</code> for example, but how do I pull out all 50 MediaUrl or SourceUrl? I was thinking that I could achieve this with a for of for-in loop but unclear how to do so. The goal is to pull those objects out and then be able to pick randomly from those specific elements. Would I first have to create a variable with an array like <code>var myArray = ["body.d.results[0].MediaUrl", body.d.results[1].MediaUrl", body.d.results[3].MediaUrl", ...]</code> ?</p>
  
  <p>Any help is greatly appreciated. I have been searching up and down for examples and tutorials but not sure how to phrase what I am looking for. I believe this question is different than here: <a href="https://stackoverflow.com/questions/19590865/from-an-array-of-objects-extract-value-of-a-property-as-array">From an array of objects, extract value of a property as array</a> because it doesn't explain how to pick randomly as well.</p>