Skip to content

Instantly share code, notes, and snippets.

@dawncold
Created April 13, 2017 15:30
Show Gist options
  • Save dawncold/72a61e596611c509ec15d007738899c0 to your computer and use it in GitHub Desktop.
Save dawncold/72a61e596611c509ec15d007738899c0 to your computer and use it in GitHub Desktop.
function Foo() {
getName = function () { alert (1); };
return this;
}
Foo.getName = function () { alert (2);};
Foo.prototype.getName = function () { alert (3);};
var getName = function () { alert (4);};
function getName() { alert (5);}
//请写出以下输出结果:
Foo.getName();
getName();
Foo().getName();
getName();
new Foo.getName();
new Foo().getName();
new new Foo().getName();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment