dimanche 23 octobre 2016

js function with n number of paranthesis

How to define a function in Javascript with n number of paranthesis. For example if we have a sum function , we should be able to call it as below

sum(2)(1)(5);

and it should return 8, where the number of paranthesis can be 1 to n.




Aucun commentaire:

Enregistrer un commentaire