Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- function test(...args) {
- args = Array.prototype.slice.call(args);
- let result = function (...args2) {
- return test.apply(test, args.concat(Array.prototype.slice.call(args2)));
- };
- result.toString = function () {
- return Array.prototype.slice.call(args).reduce((accum, item) => accum + item, 0);
- };
- return result;
- }
- console.log('SUM ' + test(1, 2, 3)(4, 5, 6)(7, 8, 9));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement