title: Adding an array to a JSON object if it doesn't exist
body: <p>I have this JSON object:</p>
  
  <pre><code>var collection = {
      "123":{
        "name": "Some Name",
        "someArray": [
            "value 0",
            "value 1"
         ]
       },
      "124":{
        "name": "Some Name"
       }, 
  </code></pre>
  
  <p>I have a method that updates and returns the collection like:</p>
  
  <pre><code>function updateCollection(id, property, value){
  return collection;
  }
  </code></pre>
  
  <p>Suppose the method call is like this:</p>
  
  <pre><code>updateCollection(124, someArray, "value 3");
  </code></pre>
  
  <p>How should I update? What I already wrote is:</p>
  
  <pre><code>function updateCollection(id, property, value){
    if(collection[id].hasOwnProperty(property)){
      collection[id][property].push(value);
    }
    else{
     //need help here 
    }
    return collection;
  }
  </code></pre>
  
  <p>Expected Output after calling method <code>updateCollection(124, someArray, "value 3");</code> should be:</p>
  
  <pre><code>"124":{ "name": "Some Name", "someArray": [ "value 3", ] }
  </code></pre>