title: JavaScript - How to make sure array manipulations are persistent inside a function?
body: <p>I am trying to write a JavaScript function (ES5) that will take in an array, filter it, and set the original array to the new one.</p>
  
  <p>Here is my plunk: <a href="https://plnkr.co/edit/OWeOjJ3SLVGYRaweyy3Z" rel="nofollow noreferrer">https://plnkr.co/edit/OWeOjJ3SLVGYRaweyy3Z</a></p>
  
  <p>Here is the basic pseudocode of what I am trying to do:</p>
  
  <pre><code>var result = [{ 'date': '20171116' }, { 'date': '20171115' }];
  var data = { 'date': '2017116' };
  deleteEntry(data, result);
  console.log(result); //should  have one entry
  
  function deleteEntry(data, result) {
    result = result.filter(function(item) {
      return item.date !== data.date;
    });
  }
  </code></pre>
  
  <p>I believe the issue is to do with array references. I am not sure how to accomplish the task.</p>