john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

addtwoinvoke

<!DOCTYPE html><html><head><title></title></head><body><pre><script>


    function addf( first )
    {
        return function( second )   // closure means it can access outer variable
        {
            return first + second;
        };
    }



    document.writeln( addf(1)(2) )  // 3


</script></pre></body></html>

  • « identityf
  • applyf »

Published

Oct 5, 2013

Category

javascript

~22 words

Tags

  • addtwoinvoke 1
  • javascript 43