Skip to content

Instantly share code, notes, and snippets.

@blankyao
Created May 26, 2011 04:12
Show Gist options
  • Save blankyao/992538 to your computer and use it in GitHub Desktop.
Save blankyao/992538 to your computer and use it in GitHub Desktop.
makeClass By John Resig
// makeClass - By John Resig (MIT Licensed)
function makeClass(){
return function(args){
if ( this instanceof arguments.callee ) {
if ( typeof this.init == "function" )
this.init.apply( this, args.callee ? args : arguments );
} else
return new arguments.callee( arguments );
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment