title: How to add new property with same key name inside declared object?
body: <p>How can I append/add new property with same key name inside declared object ? </p>
  
  <p>Here the code:</p>
  
  <pre><code>// Declared object
  var myObject = {
      name : 'John',
      age  : 15,
  };
  
  // Array list of new property need to be add to myObject
  var others = [
    { key : 'hobby', value: 'reading' },
    { key : 'hobby', value: 'writing' }
  ];
  </code></pre>
  
  <p>What i've been try so far:</p>
  
  <pre><code>ko.utils.arrayForEach(others, function(other) {
      myObject[other.key] = other.value;
  });
  </code></pre>
  
  <p>and</p>
  
  <pre><code>ko.utils.arrayForEach(others, function(other) {
      var extendObject = new Object();
      extendObject[other.key] = other.value;
  
      $.extend(myObject, extendObject);
  });
  </code></pre>
  
  <p>The result still both doesn't work either. It just replace existing property value </p>
  
  <p>What I need is something like this:</p>
  
  <pre><code>myObject: { name: 'John', age: 15, hobby: 'reading', hobby: 'writing' }
  </code></pre>
  
  <p>Please note: I don't want to make it array : <code>hobby: ['reading', 'writing']</code></p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I was implement this for search functionality, code and details above is simplified version of the part I was stuck.</p>
  
  <p>and here is the full code of what i've try to accomplish:</p>
  
  <p>my views:</p>
  
  <pre><code>&lt;form data-bind="submit: $root.getSearchData"&gt;
    &lt;input name="date_start" class="datepicker"&gt;
  
    &lt;div class="checkbox"&gt;
      &lt;label&gt;
         &lt;input type="checkbox" name="user_id[]" value="1"&gt; John
      &lt;/label&gt;
      &lt;label&gt;
         &lt;input type="checkbox" name="user_id[]" value="2"&gt; Michael
      &lt;/label&gt;
    &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>my viewmodels:</p>
  
  <pre><code>// Will contains new search property need to append to queryData
  self.searchPropertyList = ko.observableArray();
  
  // This function will fetch tasks from server
  self.getTasksFromServer = function()
  {
     // Query data
     var queryData = {
         sort : 'start',
         order: 'asc'
     };
  
     /**
      * When getSearchData function fill formData into searchPropertyList observable,
      * this function will get a notify and it will automatically loop through it 
      * and append new property to queryData.
      */
     ko.utils.arrayForEach(self.searchPropertyList(), function(opt)
     {
         queryData[opt.name] = opt.value;
     }
  
     $.ajax({
         url: 'api/tasks',
         type: 'json',
         data: queryData,
         success: function(data)
         {
         }
     });
  }
  
  // Returned form property as array into searchPropertyList observableArray 
  // and notify getTaskFromServer function
  // This is how formData may look like
  // formData = [{ name: 'date_start', value: '2014-08-26' }, { name: 'user_id[]', value: 1 }, { name: 'user_id[]', value: 2 }]; 
  self.getSearchData = function(form)
  {
       var formData = $(form).serializeArray();
  
       self.searchPropertyList(formData);
  }
  </code></pre>
  
  <p>So, ajax will request something like this:</p>
  
  <pre><code>api/tasks?sort=start&amp;order=asc&amp;date_start=2014-08-26&amp;user_id[]=1&amp;user_id[]=2
  </code></pre>
  
  <p>Someone, please help, Thanks :)</p>