Category Archives: JavaScript

Delete a member of an array

Here’s a quickie: Need to delete a member of an array in JavaScript? The traditional way is with the splice() method. Here’s an alternative using filter(): var deleteFromArray = function(array, valToRemove) { return array.filter(function(member) { return member !== valToRemove; }); }; Demonstrated in the JavaScript console: The filter() method examines each member of your array… Read More »