title: push JSON Object into Array
body: <p>I have a function, which gets a Date and is reading events from a JSON file. When the Date lays inside the time period of the event, it should be added to an array, which should be returned at the end of the function.</p>
  
  <pre><code>function getEvents(askDate) {
      var askDate = new Date(askDate);
      var result = new Array();
      $.getJSON(EVENTS_JSON, function(data) {
          $.each(data.events, function(key, entry) {
              if(isInPeriod(askDate.setHours(0,0,0,0), new Date(entry.date[0]).setHours(0,0,0,0), new Date(entry.date[1]).setHours(0,0,0,0))) {
                  result.push(entry);
              }
          });
      });
      if(result.length === 0) {
          result = false;
      }
      return result;
  }
  </code></pre>
  
  <p>Unfortunately I get the following error: "TypeError: result.push is not a function".</p>
  
  <p>The isInPeriod function works fine, previously I have had a console output just before the result.push() which has been the JSON object.</p>
  
  <p>JSON looks like:</p>
  
  <pre><code>{
      "events":   [
          {
              "id": 1,
              "name": "Example Event",
              "date": [
                  "2014/11/25 07:30:00",
                  "2014/11/25 09:00:00"
              ],
              "desc": "Lorem Ipsum sim dolor",
              "image": "http://upload.wikimedia.org/wikipedia/commons/8/84/Example.svg",
              "adress": "Example Road 12",
              "youtube": "https://www.youtube.com/watch?v=_5DqL5-izAY",
              "tags": [
                  "Example"
              ],
              "categories": [
                  "main_category",
                  "sub_category",
                  "sub_sub_category"
              ]
          }
      ]
  }
  </code></pre>