Created
July 24, 2015 21:42
-
-
Save vasanthk/fbd7d8f13ab932d3e780 to your computer and use it in GitHub Desktop.
Using reduce(), instead of filter() and map()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tollCountries = phoneNumbers.reduce(function(countries, nums) { | |
if(!num.tollFree) { | |
countries.push({ | |
// Push it in whatever format you need it. | |
}) | |
} | |
return countries; | |
}, []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment