Friday, 6 September 2013

What do you call a function that takes a value and returns a function that returns that value?

What do you call a function that takes a value and returns a function that
returns that value?

I am trying out a more functional style with Javascript using Lodash and
compose. I notice that I sometimes need a function that returns a value.
So was wondering what this was called so I can find out if Lodash actually
has this method.
var returnFn = function (i) {
return function () {
return i;
};
};

No comments:

Post a Comment