La situazione non è buona

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
Posted by nowhere man at 7:22 AM No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Blog Archive

  • ►  2022 (6)
    • ►  October (1)
    • ►  September (2)
    • ►  August (1)
    • ►  July (1)
    • ►  January (1)
  • ►  2021 (2)
    • ►  September (1)
    • ►  January (1)
  • ►  2019 (6)
    • ►  September (4)
    • ►  April (1)
    • ►  February (1)
  • ▼  2018 (1)
    • ▼  August (1)
      • Curring in javascript
  • ►  2014 (2)
    • ►  October (2)
  • ►  2013 (1)
    • ►  August (1)
  • ►  2012 (2)
    • ►  August (1)
    • ►  May (1)
  • ►  2010 (5)
    • ►  October (1)
    • ►  August (3)
    • ►  July (1)
Picture Window theme. Powered by Blogger.