Skip to content

Instantly share code, notes, and snippets.

@bhaveshdaswani93
Created December 28, 2019 05:15
Show Gist options
  • Save bhaveshdaswani93/515166b0df9b966cb0391eec26b85936 to your computer and use it in GitHub Desktop.
Save bhaveshdaswani93/515166b0df9b966cb0391eec26b85936 to your computer and use it in GitHub Desktop.
In this gist i will try to explain you about partial application
const multiply = (a,b,c) =>a*b*c;
//Partial Application
const partiallyMultiplyBy5 = multiply.bind(null,5);
partiallyMultiplyBy5(4,10) //200
// in above example partiallyMultiplyBy5 partially apply multiply function with 5 as first argument.
// when executing the partiallyMultiplyBy5 function we just have to pass remaining paramater as the first argument 5 has been remember
// due to closure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment