Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var add = (function() {
- var consoleLog = console.log,
- result = 0;
- function addition( n ) {
- result += n;
- return addition;
- }
- console.log = function() {
- for (var i in arguments) {
- if (arguments[ i ] == addition) {
- arguments[ i ] = result;
- }
- }
- consoleLog.apply(this, arguments);
- };
- return addition;
- }());
- console.log( add( 1 )( 2 )( 3 ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement