I have a nested array in javascript. The top level has a numerical index, the second level arrays contains various data. I want to be able to remove an element from the array using the top level index.
var my_array = [];
my_array[12] = ['cheese', 'egg', 'ham'];
my_array[24] = ['balloon', 'frog'];
my_array[33] = ['chicken', 'goose'];
How do I delete my_array[24]? I have tried using splice with $.inArray but inArray returned the index as -1. I don't want to use indexOf because of it's browser limitations - also I think it will give me the same problem as inArray.
Thanks!
delete my_array[24];deletewon't affect thelength. But, the property/index will be removed/undefined.