window.arrayone = ["1","2","3"];
window.arraytwo = ["1","1","1"];
arrayone.splice(arrayone.indexOf("1",-1));
arraytwo.splice(arraytwo.indexOf("1",-1));
console.log("arrayone -->" + arrayone);
console.log("arraytwo -->" + arraytwo);
How can I delete only one item. I have a number of items with the same attribute. I am trying to delete only one item. I.e array ["1", "1", "1"] Array.splice (array.indexOf (1.1)) Now if I have another set of items. The function does work and subtracts item 1. But when there is a group with similar items it does not work. Can someone tell me?
Answer: Can I close I realized my mistake. DeleteCount should be -1 negative. And not as positive as I had in the code.
JAVA SCRIPT
window.arrayone = ["1","2","3"];
window.arraytwo = ["1","1","1"];
arrayone.splice(arrayone.indexOf("1",1));
arraytwo.splice(arraytwo.indexOf("1",1));
alert("arrayone -->" + arrayone);
alert("arraytwo -->" + arraytwo);