Hi i need to remove the array from another array.Below is the code that i had tried
var dummyObj = ["item1"];
var dummyArray = [ "item1", "item3", "item2"];
var data1=removeFromArray(dummyArray, dummyObj);
console.log("data1"+data1)
function removeFromArray(array, item)
{
while((index = array.indexOf(item)) > -1)
array.splice(index,1);
return array
}
below is my output
item1,item3,item2
But the required output is
item3,item2
Dont know where i am going wrong.Any help regarding this will be much helpful