링크: http://ejohn.org/blog/javascript-method-overloading/


Overriding 기능찾다가 찾게 되었다. 나중에 써먹어야겠다.

참고로 존레식은 jQuery 만든 사람이다.


// addMethod - By John Resig (MIT Licensed)

function addMethod(object, name, fn){

    var old = object[ name ];

    object[ name ] = function(){

        if ( fn.length == arguments.length )

            return fn.apply( this, arguments );

        else if ( typeof old == 'function' )

            return old.apply( this, arguments );

    };

}



posted by 뚱2