I am trying to remove a piece of a data from a json array. For example I have this array
var favorites = {
\"userID\": \"12345678\",
\"favorit
If you want to actually remove an item from the array so that all items after it in the array move down to lower indexes, you would use something like this:
favorites.favorites[1].items.splice(1, 1);
You want to operate on the actual items
array which means calling methods on the items
array. For .splice()
, you pass the index where you want to start modifying the array and then the number of items to remove thus .splice(1, 1)
which will remove 1 item starting at index 1.