title: Javascript: Filter a JSON conditionally based on the value of a key?
body: <p>After retrieving a JSON such as this: </p>
  
  <pre><code>"JSON": [
  {
    "mySchool": "college",
    "myHome": "apartment",
    "myFavoriteSport": "soccer"
  },
  {
    "mySchool": "highschool",
    "myHome": "house",
    "myFavoriteSport": "hockey"
  },
  {
    "mySchool": "college",
    "myHome": "box",
    "myFavoriteSport": "soccer"
  },
  {
    "mySchool": "elementary",
    "myHome": "tent",
    "myFavoriteSport": "soccer"
  }
  ]
  </code></pre>
  
  <p>How could I filter it conditionally so that... if <code>soccer</code> is the value of <code>myFavoriteSport</code> key, then return an array of all objects containing the <code>myFavoriteSport: soccer</code> pair? I'm sure I'll end up <code>pushing</code>the object into the array at the end, but I don't quite know how to single it out so that I can assign it to a variable. </p>
  
  <p>I'm sure it will involve some type of loop, but this is my first time working with JSON and objects of this type so I'm a little unsure of how to approach it. </p>