JAVASCRIPT FUNCTION WITH VARARGS
How to write javascript add function such that add(a)(b) and add(a,b) both return sum ?
goli202084 Answered question
function add(a, b) { if (arguments.length === 1) { return function(b2) { // inner function which is a closure return a + b2; // it has access to the first param a }; } return a + b; }
goli202084 Answered question