I have an array like this
arr = [\"orange\",\"red\",\"black\",\"white\"]
I want to augment the array object defining a deleteElem()<
deleteElem()<
Here's how it's done:
var arr = ["orange","red","black","white"]; var index = arr.indexOf("red"); if (index >= 0) { arr.splice( index, 1 ); }
This code will remove 1 occurency of "red" in your Array.