I'm trying to filter an array of objects to remove some elements from it. I'm trying to use jQuery.grep(), but I don't know if that's the best tool for the job.
Every element on my array of objects has a "type" element, and I need to remove the ones with a particular "type" value. But those values are unknown, since they will be provided by the user.
Here's what I'm stuck with:
theNewArray = $.grep(database, function( n ) {
return ( n.type != /* I don't know what to put here */ );
});
I've tried getting all the "type" values in an array, but I don't know what to do with it.
Array.prototype.filtergrepbecausegrepdoesn't affect original source.