Created
July 27, 2020 19:21
-
-
Save sudikrt/aa541cb5c11837c2d3a5c68a2d711cd1 to your computer and use it in GitHub Desktop.
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
//Function Currying | |
let multiply = function (x, y) { | |
console.log (x*y); | |
} | |
let multiplyByTwo = multiply.bind (this, 2); | |
multiplyByTwo (5); | |
//Function Currying | |
let multiply = function (x, y) { | |
console.log (x*y); | |
} | |
let multiplyByTwo = multiply.bind (this, 2); | |
multiplyByTwo (5); | |
//make a copy of multiply method and create more method by presettting the arguments | |
let multiplyByThree = multiply.bind (this); | |
multiplyByThree (3,5); | |
//Closur | |
let multiply = function (x) { | |
return function (y) { | |
console.log (x * y); | |
} | |
} | |
//its a kind of creatting box and which allows to use both params in the returned function | |
let multiplyByTwo = multiply (2); | |
multiplyByTwo(3); | |
//Closur | |
let multiply = function (x) { | |
return function (y) { | |
console.log (x * y); | |
} | |
} | |
//its a kind of creatting box and which allows to use both params in the returned function | |
let multiplyByTwo = multiply (2); | |
multiplyByTwo(3); | |
let multiplyByThree = multiply (3); | |
multiplyByThree(3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment