To increase performance you have to measure what solution will be faster. Let's play for a moment https://jsperf.com/filter-than-map-or-reduce/1
Any other test cases are welcome.

If you want to play with benchmark against NodeJS (remember to npm i benchmark)
var suite = new (require('benchmark')).Suite function getSampleInput() { return [{file: 'foo'}, {other: 'bar'}, {file: 'baz'}, {file: 'quux'}, {other: 'quuxdoo'}, {file: 'foobar'}, {file: 'foo'}, {other: 'bar'}, {file: 'baz'}, {file: 'quux'}, {other: 'quuxdoo'}, {file: 'foobar'}, {file: 'foo'}, {other: 'bar'}, {file: 'baz'}, {file: 'quux'}, {other: 'quuxdoo'}, {file: 'foobar'}, {file: 'foo'}, {other: 'bar'}, {file: 'baz'}, {file: 'quux'}, {other: 'quuxdoo'}, {file: 'foobar'}, {file: 'foo'}, {other: 'bar'}, {file: 'baz'}, {file: 'quux'}, {other: 'quuxdoo'}, {file: 'foobar'}, {file: 'foo'}, {other: 'bar'}, {file: 'baz'}, {file: 'quux'}, {other: 'quuxdoo'}, {file: 'foobar'}, {file: 'foo'}, {other: 'bar'}, {file: 'baz'}, {file: 'quux'}, {other: 'quuxdoo'}, {file: 'foobar'}, {file: 'foo'}, {other: 'bar'}, {file: 'baz'}, {file: 'quux'}, {other: 'quuxdoo'}, {file: 'foobar'}] } // author https://stackoverflow.com/users/3716153/gaafar function reduce(results) { return results.reduce( (acc, result) => result.file ? acc.concat([result.file]) : acc , [] ) } // author https://stackoverflow.com/users/1223975/alexander-mills function filterThanMap(results) { return results.filter(function(r){ return r.file; }) .map(function(r){ return r.file; }); } // author https://stackoverflow.com/users/5361130/ponury-kostek function forEach(results) { const files = []; results.forEach(function(r){ if(r.file) files.push(r.file); }); return files } suite .add('filterThanMap', function() {filterThanMap(getSampleInput())}) .add('reduce', function() {reduce(getSampleInput())}) .add('forEach', function() {forEach(getSampleInput())}) .on('complete', function() { console.log('results:') this.forEach(function(result) { console.log(result.name, result.count, result.times.elapsed) }) console.log('the fastest is', this.filter('fastest').map('name')[0]) }) .run()
results? A multidimensional array[{file:{file:1}}, {notfile:{file:1}}]?[{},{file:x}, {}, {file:y}], etc.[{},{file:x}, {}, {file:y}]" Well, that array does not match context of JavaScript at Question. In that case.map()is not necessary. You can use.filter()alone to return expected resultresultsas a nested array. Why is.map()necessary? To return an array of[x, y]? What is expected result?