JSFiddle - React, Tailwind, and code Playground
HTML
<button type="button" onclick="removeItem()">
Remove
</button>
<br/>
<span></span>
JavaScript
$(document).ready(function() {
var ios = [{
"id": 1,
"type": "free",
"cat": "Diversi",
"qty": 50,
"date": "2016-11-02T09:51:48.872Z",
"descr": ""
}, {
"id": 2,
"type": "gree",
"cat": "Lavoro",
"qty": 40,
"date": "2016-11-02T10:08:11.362Z",
"descr": ""
},
{
"id": 3,
"type": "hree",
"cat": "Lavoro",
"qty": 33,
"date": "2016-11-01T11:08:11.122Z",
"descr": ""
}];
localStorage.setItem('ios', JSON.stringify(ios));
});
function removeItem() {
var io = {
"id": 1,
"type": "in",
"cat": "Diversi",
"qty": 50,
"date": "2016-11-02T09:51:48.872Z",
"descr": ""
};
var ios = JSON.parse(localStorage.getItem('ios'));
var index = ios.map(function(element) {
return element.cat;
}).indexOf(io.cat);
alert(index);
ios.splice(index, 1);
localStorage.setItem('ios', JSON.stringify(ios));
}