Skip to content

Instantly share code, notes, and snippets.

@fearphage
Created April 12, 2009 15:55
Show Gist options
  • Select an option

  • Save fearphage/94033 to your computer and use it in GitHub Desktop.

Select an option

Save fearphage/94033 to your computer and use it in GitHub Desktop.
var ok1, ok2, ok3, ok4, ok5, ok6;
function A(){
ok1 = (this.constructor!=arguments.callee);
};
function B(){
ok2 = (this.constructor==arguments.callee);
};
A();
new B();
function Foo(){
if (this.constructor!=arguments.callee)
return new arguments.callee({__is_arguments:arguments});
else if(arguments[0] && arguments[0].__is_arguments)
return arguments.callee.apply(this,arguments[0].__is_arguments);
this.init.apply(this, arguments);
}
Foo.prototype = {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment