This is not happening

Tell us what’s happening:

Your code so far




// Only change code below this line


function myLocalScope(){var myVar = "foo";console.log(myVar);}
myLocalScope();
console.log(myVar);


// Run and check the console
// myVar is not defined outside of myLocalScope


// Now remove the console log line to pass the test

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36.

Challenge: Local Scope and Functions

Link to the challenge:

Hi,

Can you explain what is happening?

It looks so compicated in there . Can you reset the code and just add

var myVar ;

below here