JSFiddle - React, Tailwind, and code Playground

by strange_atom

JavaScript

(function(){
  
    function myPartial(func) {
     
        var funcArgs = Array.prototype.slice.call(arguments,1);
       
        return function() { 
        
            var funcArgs2 = Array.prototype.slice.call(arguments);
            var newArgs = funcArgs.concat(funcArgs2);
            return func.apply(null, newArgs);
            
        };
    
  }
  
  function add10(a,b) {return a+b+10;}
  //function sumNum(a,b) {return a+b;}
  //function sumThree(a,b,c) {return a+b+c;}
  //function sum10(a,b,c,d,e,f,g,h,i,j) {return a+b+c+d+e+f+g+h+i+j;}
  
    
var tmp = myPartial(add10, 10);
console.log(tmp(10));
console.log(tmp(100));
  //console.log(myPartial(add10,3,23,4,34,34)(3,3,3));
  //console.log(partial(sumNum, 2, 5));
  //console.log(partial(sumThree, 3, 5, 6));
  //console.log(partial(sum10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1));
  
}());