I would like to filter an array of items by using the map() function. Here is a code snippet:
map()
var filteredItems = items.map(function(item) {
That's not what map does. You really want Array.filter. Or if you really want to remove the elements from the original list, you're going to need to do it imperatively with a for loop.