Here is a currying snippet from javascript patterns:
function add(x, y) {
var oldx = x, oldy = y;
if (typeof oldy === "undefined") { // partial
return function (newy) {
return oldx + newy;
}
}
// full application
return x + y;
}
ref: https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/currying.html
What is the point of local vars oldx and oldy?