Last active
June 27, 2018 09:07
-
-
Save ilya-korotya/5a227aa4483b69c2e93a3cd38cebca2f to your computer and use it in GitHub Desktop.
Functional programming in JS
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 = x => x%2 === 0 | |
const isBigThan = size => int => int > size | |
const pluceValue = value => int => value + int | |
const isInInterval = (start, end) => int => start < int && end > int | |
let res = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
.filter(isEven) | |
.filter(isBigThan(5)) | |
.map(pluceValue(2)) | |
.filter(isInInterval(7, 10)) | |
console.log(res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment