Functional inheritance

function applyf(binary) { return function(y) { return function (z) { return binary(y , z); } } } function add(x,y) { return x + y; } function mul(x,y) { return x * y; } var addf = applyf(add); console.log(addf(3)(4)); console.log(applyf(mul)(5)(6));

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.