Author: Not specified | Language: javascript |
Description: Not specified | Timestamp: 2018-05-10 11:35:12 +0000 |
View raw paste | Reply |
- function sum(x) {
- if (arguments.length == 2) {
- return arguments[0] + arguments[1];
- } else {
- return function(y) { return x + y; };
- }
- }
- console.log(sum(2,3));
- console.log(sum(2)(3));
View raw paste | Reply |