I know this question has been asked for a long time, but it seems that many people are still looking for the answer. I just wrote this. I tested it in several ways, and it seems to work the way I wanted it to.
var yourArr = [1, 2, 3, 4]; // use your array here var removeIndex = 1; // item to get rid of var explode = function(array, index) { // create the function var frontSet = subset(array, 0, index - 1); // get the front var endSet = subset(array, index , array.length - 1); // get the end yourArr = concat(frontSet, endSet); // join them }; explode(yourArr, removeIndex); // call it on your array
This is one way. I think you could also scroll through the array. Sort of...
var yourArr = [1, 2, 3, 4]; var removeIndex = 2; var newArr = []; for(var i = 0; i < yourArr.length; i++) { if(i < removeIndex) { append(newArr, yourArr[i]); } else if(i > removeIndex) { append(newArr, yourArr[i]); } } yourArr = newArr;
... I think this will work too. Hope this helps anyone who needs it.
source share