I assume that function hoisting will not allow to access parent functions product but why global scope is not accessed.Please Help.Thanks
const product = 'product'
function foo() {
employeeId();
var product = 'Car';
return;
function employeeId() {
//this is giving me undefined
console.log(product);
}
}
foo();
When I try to get the value of product it's giving undefined. I am very confused, not sure what is causing this issue at all.