the code is as follows
function Foo(){
getName = function(){
console.log(1);
};
return this;
}
Foo.getName = function() {
console.log(2);
}
Foo.prototype.getName = function(){
console.log(3);
}
var getName = function(){
console.log(4);
};
function getName() {
console.log(5);
}
Foo.getName(); //
getName(); //
Foo().getName(); //
getName(); //
new Foo.getName(); //
new Foo().getName(); //
new new Foo().getName(); //
what I want to ask now is: can"t new Foo () be written as new Foo without parentheses? why is the result different between question 5 and question 6? and the last question directly does not understand why the result is like this. Thank you for your generous advice
.