Skip to content

Instantly share code, notes, and snippets.

@Arieg419
Last active December 15, 2017 11:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Arieg419/83e21309574552aa266f77d70db280fc to your computer and use it in GitHub Desktop.
Save Arieg419/83e21309574552aa266f77d70db280fc to your computer and use it in GitHub Desktop.
const bankStatement =
name =>
location =>
balance =>
`Hello ${name}! Welcome to the bank of ${location}. Your current balance is ${balance}`;
const statementExpectingLocation = bankStatement("Omer");
const statementExpectingBalance = statementExpectingLocation("NYC");
const bankStatementMsg = statementExpectingBalance("100 million"); // wishful thinking?
console.log(bankStatementMsg); // Hello Omer! Welcome to the bank of NYC. Your current balance is 100 million
// We could also call the function with all the arguments up front
const msg = bankStatement("Jeff Bezos")("Silicon Valley")("97.7 billion");
console.log(msg); // Hello Jeff Bezos! Welcome to the bank of Silicon Valley. Your current balance is 97.7 billion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment