function c(){
var b=1
function a(){
console.log(b)//因b在下面,表示未赋值undefined
var b=2
console.log(b)//2
}
a()
console.log(b)//1
}
c()
function Foo(){
getName=function(){alert(1)}
return this;//代表了window
}
Foo.getName=function(){alert(2)}
Foo.prototype.getName=function(){alert(3)}
var getName=function(){alert(4)}
function getName(){alert(5)}
Foo.getName();//2
getName();//4,变量优先级更高
Foo().getName();//1
getName();//1
new Foo().getName();//3,new优先级更高,继承了Foo.prototype属性
new Foo.getName();//2
new new Foo.getName();//2