Created
October 22, 2013 20:17
-
-
Save jozsefDevs/7107417 to your computer and use it in GitHub Desktop.
A simple way to implement a validation by JavaScript currying
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
var above = function(limit){ | |
return function(value){ | |
return value > limit; | |
}; | |
}; | |
var isAbove10 = above(10); | |
console.log(isAbove10(5)); // false | |
console.log(isAbove10(8)); // false | |
console.log(isAbove10(12)); // true | |
console.log(isAbove10(20)); // true | |
console.log(isAbove10(25)); // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very nice.