Created
December 28, 2019 05:15
-
-
Save bhaveshdaswani93/515166b0df9b966cb0391eec26b85936 to your computer and use it in GitHub Desktop.
In this gist i will try to explain you about partial application
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 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