fruits.findIndex(x => x.name === '🍎'). Therefore we need to execute two functions to remove an item.
So we need to find a simple method that removes an item from the array. We can use the filter function for this:
fruits = fruits.filter(x => x.name != "🍎")
The filter function is the cleanest method compared to other alternatives. Also its an immutable function so it cannot have side effects like splice method. I think its best way to remove an element from the array.
See you in my next post ✌️