title: Passing object key as javascript function argument
body: <p>I have an object, op_hours, which has days of the week as keys from mon - sun, with arrays of strings as values (In my actual code the values are arrays of objects, but I have changed them to strings here for simplicity). </p>
  
  <p>How may I add/remove strings from a certain key by passing the required key into a function argument?</p>
  
  <p>For instance,</p>
  
  <pre><code>function add(somethingToAdd, op_hours, key) {
    var sample = op_hours.key;
    sample.push(somethingToAdd);
    op_hours.key = sample;
    return op_hours;
  }
  
  var op_hours = {
  
    "mon": ["apple","orange"],
    "tue": ["table", "chair"],
    "wed": ["shark", "dolphin", "jellyfish"],
    "thu": [],
    "fri": [],
    "sat": [],
    "sun": []
  };
  </code></pre>
  
  <p>I currently have to write 14 functions, seven for adding and seven for deleting as follows:</p>
  
  <pre><code>function addMon(miniObj, bigObj) {
    var sample = bigObj.mon;
    sample.push(miniObj);
    bigObj.mon = sample;
    return bigObj;
  }}
  </code></pre>