I am trying to delete/remove an object which is at at position x in array A such that Array A is inside another array such as this:
var lol = [
[
{'a':1},
{'b':2},
{'c':3}
],
[
{'d':4},
{'e':5},
{'f':6}
],
[
{'g':7},
{'h':8},
{'i':9}
]
];
Now lets say I would like to remove object with key 'f'
. I have a
function deleteNestedElement(outerIndex, innerIndex) {
lol[outerIndex].splice(0, innerIndex);
}
on calling
deleteNestedElement(2,0);
alert(lol);
I am getting the result as this:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Here is my JsFiddle
I need to delete the specific element as desired from this array.