adding values and deleting values from same array javascript code example
Example: delete from array based on value javascript
var index = array.indexOf(item);
if (index !== -1) array.splice(index, 1);
var index = array.indexOf(item);
if (index !== -1) array.splice(index, 1);