// You should use the filter method rather than map unless you want // to mutate the items in the array, in addition to filtering. // eg. let filteredItems = items.filter(function(item) { return ...some condition...; });