I have the following array settings, i, e:
var myArray = new Array();
Using this array, I dynamically create the breadcrumbs menu as the user adds additional menu items. I also allow them to delete certain menu items with breadcrumbs by clicking on the cross next to the eatch breadcrumb menu item.
An array may contain the following data:
myArray[0] = 'MenuA'; myArray[1] = 'MenuB'; myArray[2] = 'MenuC'; myArray[3] = 'MenuD'; myArray[4] = 'MenuE';
My questions:
a) How to remove element [1] from myArray in JavaScript and then recalculate indexes or is it impossible?
b) If I do not need the MenuB menu option, do I need to splic it to remove it?
My problem is that if the user deletes the menu items and then creates the news at the end, how will the indexes to these items be distributed?
I just want to be able to delete elements, but I donβt know how the indexes of the array are processed.
tonyf source share