w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to remove Multiple elements from an Array by name

You just need to iterate the itemsToRemove -

var mularr
= ["jQuery","JavaScript","HTML","Ajax","Css"];
var itemstoRemove = ["jQuery","HTML"];
for(var i=0;i<itemstoRemove.length;i++)
{
   mularr.splice($.inArray(itemstoRemove[i], mularr),1); // note the [i]
}
console.log(mularr);
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.