title: (My failed) Javascript challenge: function add()()() with closures
body: <p>Need to write a function, that can get up to 3 arguments and return a sum.
  Here is a ways, how it can be called:</p>
  
  <pre><code>add(2, 5, 10); // 17
  add(2, 5)(10); // 17
  add(2)(5)(10); // 17
  add(2)(5, 10); // 17
  </code></pre>
  
  <p>I have write a function, that can do it:</p>
  
  <pre><code>function add(a) {
    var currentSum = [].reduce.call(arguments, function(c, d) { return c + d; });
  
    function f(b) {
      currentSum += [].reduce.call(arguments, function(c, d) { return c + d; });
      return f;
    }
  
    f.toString = function() {
      return currentSum;
    };
  
    return f;
  }
  </code></pre>
  
  <p>BUT! The challenge task says that I CAN'T use toString of valueOf to get result.
  How can I solve it?</p>
  
  <p>P.S. I have noticed that I failed the challenge, so why I'm asking.</p>