Last active
July 4, 2016 07:10
-
-
Save stpettersens/107f1fa1f8d95707bd306a4ee9c2f195 to your computer and use it in GitHub Desktop.
Coolifier example in JS (function which returns a function) [@vakila]
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
/* | |
Adapted from Anjana Vakil's (@vakila) Learning Functional Programming with JavaScript presentation @ JSUnconf 2016 | |
https://youtu.be/e-5obm1G_FY?t=9m24s | |
*/ | |
'use strict' | |
function makeAdjectifier (adjective) { | |
return function (string) { | |
return adjective + ' ' + string | |
} | |
} | |
const coolifier = makeAdjectifier('cool') | |
coolifier('conference') // ==> "cool conference" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment