Last active
February 3, 2019 14:01
-
-
Save Beraliv/4538dd7e707718518be7d2f44a1e7a00 to your computer and use it in GitHub Desktop.
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
const isEven = value => value % 2 === 0; | |
const mapFilterReduce = array => | |
// gets values from array | |
array | |
// transforms value to value + 1 | |
.map(value => value + 1) | |
// ignores odd values | |
.filter(isEven) | |
// applies addition | |
// starts from 0 | |
.reduce((sum, value) => sum + value, 0); | |
const ages = [16, 23, 24] | |
mapFilterReduce(ages) // 24 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment