title: delete an object from an array of objects in local storage javascript
body: <p>I have an array of objects in local storage like this:</p>
  
  <pre><code>ios = [{
      "id" : 1,
      "type" : "in",
      "cat" : "Diversi",
      "qty" : 50,
      "date" : "2016-11-02T09:51:48.872Z",
      "descr" : ""
    }, {
      "id" : 1,
      "type" : "in",
      "cat" : "Lavoro",
      "qty" : 50,
      "date" : "2016-11-02T10:08:11.362Z",
      "descr" : ""
    }];
  </code></pre>
  
  <p>I want to delete one of the objects with this function:</p>
  
  <pre><code>function remove(io) {
      var ios = localStorage.getItem('ios') ? JSON.parse(localStorage.getItem('ios')) : [];
      var index;
      for (var i = 0; i &lt; ios.length; i++) {
          if (ios[i] === io) {
            index=i;
            break;
          }
      }
      ios.splice(index, 1);
      localStorage.setItem('ios', JSON.stringify(ios));
  }
  </code></pre>
  
  <p>But when i call the function, and pass it the parameter to delete, it doesn't delete the one I want, but the first one in local storage instead.
  Can anyone help me please?</p>