Created
November 13, 2024 06:19
-
-
Save Trung0246/6fc3f265935a399de48bdf12bf20b040 to your computer and use it in GitHub Desktop.
Correct form.
This file contains hidden or 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 compose = (...fns) => (...args) => fns.reduceRight((res, fn) => [fn.call(null, ...res)], args)[0]; | |
| var toUpperCase = s => s.toUpperCase(); | |
| var head = arr => arr[0]; | |
| var tail = arr => arr.slice(1); | |
| var split = s => arr => arr.split(s); | |
| var join = s => arr => arr.join(s); | |
| var map = fn => arr => arr.map(fn); | |
| var filter = fn => arr => arr.filter(fn); | |
| compose(join(". "), map(compose(toUpperCase, head)), split(" "))("hunter stockton thompson") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment