I have seen this question in on of the JS Quizes. Not able to understand how, How does these two different codes return the same result. I read about JS Hoisting but unable to understand this.
function bar(){
return foo;
function foo(){}
var foo='11'
}
bar()
function bar(){
return foo;
var foo='11'
function foo(){}
}
bar()