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( obj ) {
- if (obj == addition) {
- consoleLog( result );
- } else {
- consoleLog( obj );
- }
- };
- return addition;
- }());
- console.log( add( 1 )( 2 )( 3 ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement