Ho una matrice indicizzata stringa che vorrei rimuovere un elemento da.Splicing una matrice indicizzata stringa in JavaScript
Si consideri il codice seguente esempio:
var arr = new Array();
arr[0] = "Zero";
arr[1] = "One";
arr[2] = "Two";
arr.splice(1, 1);
for (var index in arr)
document.writeln(arr[index] + " ");
//This will write: Zero Two
var arr = new Array();
arr["Zero"] = "Zero";
arr["One"] = "One";
arr["Two"] = "Two";
arr.splice("One", 1); //This does not work
arr.splice(1, 1); //Neither does this
for (var index in arr)
document.writeln(arr[index] + " ");
//This will write: Zero One Two
Come rimuovo "One" dal secondo esempio come ho fatto nel primo?
possibile duplicato di [Trova tutti i corrispondenti modelli regex e indice della partita nella stringa] (http: // StackOverflow. it/questions/6178335/find-all-matching-regex-patterns-and-index-of-the-match-in-the-string) – Gajus