Somehow I didn’t know that you can use bind as a built in way to do partial function application in JavaScript.

Somehow I didn’t know that you can use bind as a built in way to do partial function application in JavaScript.

var add = function (a, b) {

return a + b;

};

var add5 = add.bind(null, 5);

add5(10) === 15;

The first arg is commonly used to bind the function “this” variable. What I didn’t realise was that subsequent args get prepended as arguments to the bound function.