
A variable 'y' is defined in global scope, and another variable of same name is defined inside an 'if' block in function foo:
var y = 4; // Global scope
function foo(x) {
 if(x)
  var y = 3;
 return y;
}
// Call foo and log 
console.log(foo(1));
What will be logged on console?