Tell us what’s happening:
I am confused how to add the (.loc) here. It doesn’t make sense to me…
Your code so far
function myLocalScope() {
console.log(myVar);
}
myVar = myLocalScope(myVar);
console.log(myVar);
}
myLocalScope(loc);
// Run and check the console
// myVar is not defined outside of myLocalScope
console.log('outside myLocalScope', myVar);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
Challenge: Basic JavaScript - Local Scope and Functions
Link to the challenge: