I am attempting to splice a nested array out of its parent array. Consider the following array. items.splice(0,1)
should give me the first nested array([1,2]), however it seems to give me the first nested array, still nested inside of an array:
var items = [[1,2],[3,4],[5,6]];
var item = items.splice(0,1); // should slice first array out of items array
console.log(item); //should log [1,2], instead logs [[1,2]]
However it seems to return the needed array (first item), in another array. And I'm not able to get the full array unless I do item[0]
. What in the world am I missing!?