Manipulate pure javascript function to handle arguments.
I would like to get a function named "add" which is able to store and add its arguments (and obviously print it). Simple right ?
Steps :
Now you should be able to have these results :
add(4);
add.toString(); // 4
add.reset();
add.toString(); // 0
add(4,7)(); // 11
add(1)(2)(3)(); // 17
add.reset()(2)(); // 2
add.reset()(1)(2)(3)()(2,4,5)(2)(); // 19
12, Febuary 2015
Less than 30 minutes
Less than 25