title: create a function that will add numbers together when called in succession
body: <p>I need a single function which will return the below output.</p>
  
  <pre><code>add(1)     =  1
  add(1)(2)  =  3
  add(1)(2)(3) = 6
  </code></pre>
  
  <p>like wise the function should return the result.</p>
  
  <p>I want a function <code>function add(){}</code> to perform the above task.</p>
  
  <p>Please help me with an optimized solution</p>