I want remove one item from my array. For example i want remove "Apple" from array. The code like below :
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.splice(2,1);
When i run this code, the output is ["Apple"]. The output should be ["Banana", "Orange", "Mango"]. Please help me to find what wrong with my code?
I am not sure, but yes, you must be taking extract from that splice, instead you need to take actual array as is.
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.splice(2,1);
console.log(fruits);