Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

记一个 Javascript 面试问题 #5

Open
RicoLiu opened this issue Mar 5, 2018 · 0 comments
Open

记一个 Javascript 面试问题 #5

RicoLiu opened this issue Mar 5, 2018 · 0 comments

Comments

@RicoLiu
Copy link
Owner

RicoLiu commented Mar 5, 2018

题目

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();

参考:

Wscats/articles#85

@RicoLiu RicoLiu changed the title 一个 Javascript 面试问题 记一个 Javascript 面试问题 Mar 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant