The print is different,why?
the first part, I get 1,2
var a = 1;
console.log(a);
function a(){}
a = 2;
console.log(a);
the second part,I get two function a(){}
var a = 1;
if(true){
console.log(a);
function a(){}
a = 2;
}
console.log(a);