Skip to content

Instantly share code, notes, and snippets.

Created April 18, 2017 07:27
Show Gist options
  • Save anonymous/7c61901d15000bc80c3eaf464e6209ae to your computer and use it in GitHub Desktop.
Save anonymous/7c61901d15000bc80c3eaf464e6209ae to your computer and use it in GitHub Desktop.
7.6 Partial created by smillaraaq - https://repl.it/HICV/7
function partial(paramA, paramB){
var resultA=paramA(paramB,0);
var resultB=paramB;
console.log(resultA, resultB);
var resultFunction=function(param){
return resultA+param;
};
return resultFunction;
}
var summer = function(a, b) { return a + b };
var sumFive = partial(summer, 5);
sumFive(10) // => 15;
/* SCHOOL SOLUTION
function partial(fn, arg) {
return function(val) {
return fn(arg, val);
}
}
*/
//did not finish bonus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment