We want to create a function that will add numbers together when called in succession.
add(1)(2) == 3 // true
We also want to be able to continue to add numbers to our chain.
add(1)(2)(3) == 6 // true
add(1)(2)(3)(4) == 10 // true
add(1)(2)(3)(4)(5) == 15 // true
and so on.
A single call should return the number passed in.
add(1) == 1 // true
and we should be able to store the result and reuse it.
var addTwo = add(2);
addTwo == 2 // true
addTwo(3) == 5 // true
addTwo(3)(5) == 10 // true
We can assume any number being passed in will be valid javascript number.