Skip to content

Instantly share code, notes, and snippets.

@jondavidjohn
Created September 16, 2011 21:06
Show Gist options
  • Save jondavidjohn/1223151 to your computer and use it in GitHub Desktop.
Save jondavidjohn/1223151 to your computer and use it in GitHub Desktop.
John Resig's Class instatiator
// 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