I've used done one of three things.
1) filter and then map (Illa's example)
2) Create a new array and then inside a forEach, append to it.
3) I wrote a flatMap function I use sometimes
array.flatMap = function(array, f, self) {
var results = [];
goog.array.forEach(array, function(elem, i, array) {
goog.array.extend(results, f.call(this, elem, i, array));
}, self);
};
You would use it like
var processedItems = array.flatMap(items, function(item) {
}];
} else {
return [];
}
});
If you are familiar with flatMap in other languages, you'll recognize that you can do more than just filter, though.
I haven't tested them but in order of increasing performance, I'd guess #3 #1 #2, and readability in reverse order.