Thursday, August 23, 2018

Curring in javascript



function add(n) {
    v = function( nn) { return add(n + nn) }
    v.valueOf = function() { return(n) }
    return v
}

console.log(add(1)(2)(10))


support any number of parameters

No comments:

Post a Comment