Created
August 23, 2017 10:25
-
-
Save pokorson/c352ceb9888bffdc71554869519596b9 to your computer and use it in GitHub Desktop.
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
const greet = (greeting, name) => { | |
console.log(`${greeting} ${name}`); | |
}; | |
greet("hello", "Adam"); | |
greet("hello", "Mateusz"); | |
greet("hi", "Mateusz"); | |
greet("hi", "Adam"); | |
const createGreeting = greeting => { | |
return name => { | |
console.log(`${greeting} ${name}`); | |
}; | |
}; | |
const hiGreeting = createGreeting("hi"); | |
const helloGreeting = createGreeting("hello"); | |
hiGreeting("Adam"); | |
hiGreeting("Mateusz"); | |
helloGreeting("Mateusz"); | |
helloGreeting("Adam"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment