.shift(); or .unshift();

I was curious is there a way to add or remove items in an array from other then the beginning or end.
Like if this was my array [ [“john”, 1], [“john”, 2], [“john”, 4], [“john”, 5] ] and I wanted to add [“john”, 3] into the center.

There is splice() which let you both add and remove items to the array to any position

2 Likes

Thank you very much. for both the answer and the link.