Remove array element by index
08
June
2013
function removeByIndex(arr, index) {
    arr.splice(index, 1);
}
 
test = new Array();
test[0] = 'Apple';
test[1] = 'Ball';
test[2] = 'Cat';
test[3] = 'Dog';
 
alert("Array before removing elements: "+test);
 
removeByIndex(test, 2);
 
alert("Array after removing elements: "+test);

Click here to Remove Array element by Index:

  • 631 View
  • Pin It