1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <script> function currying(num1){ return function (num2){ return function(num3){ return num1+num2+num3; } } };
console.log(currying(3)(5)(1)); console.log(currying(3)(5)(2));
var number=currying(12)(9); console.log(number(3)); console.log(number(4)); console.log(number(5)); </script> </body> </html>
|