Hello!
I am looking for a solution to remove 1 item from a JSON array based on the value of the item and not the position in the array.
I am creating a photo sharing app.
say 100 users ‘like’ a photo. I will add their userID into an array of ‘likes’.
then say the first user to like the photo decides they dont like it anymore. so they want to remove themself from the list. If nobody else is interacting with that list, the index would be no problem to figure out.
I am wondering if more than 1 person was interacting with a JSON array at the same time which could cause changing indices for any given value in that array, is there a way to delete an array value based on the value itself vs the index of the value in the array.
the idea would be like
var x = [‘car’, ‘poop’, ‘house’]
in X, find any value that = “poop” and delete it
vs in X delete # 1