Hint
Function declarations win over var during hoisting. But later assignments still overwrite.
console.log(foo);
var foo = 'bar';
function foo() {
return 'function';
}
console.log(foo);[Function: foo] bar
Explanation: Function declarations take priority over var during hoisting. So foo is the function initially. Then the var assignment overwrites it with "bar".
Key Insight: Function declarations win over var during hoisting. But later assignments still overwrite.