title: Function return function javascript
body: <p>I have a simple demo:</p>
  
  <pre><code>function add(a) {
      return function (b) {
          return a + b
      }
  }
  </code></pre>
  
  <p>Now when I call <code>add(1)(2)</code> it will give me <code>3</code></p>
  
  <p>but I want something like this:</p>
  
  <p><code>add(1)(2)(3)</code> -> 6</p>
  
  <p><code>add(1)(2)(3)(4)</code> -> 10</p>
  
  <p>it means I can add more function if I want. How to write it?</p>