hi, I am having a collection like this:
var ColList = [ { ID: "1", Name: "Test1"}, { ID: "2", Name: "Test2"}, { ID: "3", Name: "Test3"}, { ID: "4", Name: "Test4"}]
I want to remove the object with value ID = 2 from ColList
just like we do in c# obj.Remove(obj1) or obj.RemoveAt(1) sort of.
How can this be achieve in javascript or jquery
and also how can I add new obj in ColList
Thanks
Dipankar BiswasPosted Aug 19, 2014, 5:16 AM
someArray = [{name:"Kristian", lines:"2,5,10"},
{name:"John", lines:"1,19,26,96"},
{name:"Brian",lines:"3,9,62,36" }]
johnRemoved = someArray
.filter(function (el) {
return el.name !== "John";
});