Basic JavaScript: Local Scope and Functions - What do I do?

Tell us what’s happening:

Hi there!

I am making this lesson " Basic JavaScript: Local Scope and Functions" and I put this code (in attachment), but I cant get success. Can you help?

Your code so far


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

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


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36.

Challenge: Local Scope and Functions

Link to the challenge:

Hi @alysson.campos96.
Welcome to FCC. You are supposed to follow the instructions. Simply add your code without removing what is there.

function myLocalScope() {

  // Only change code below this line
  var myVar
  console.log('inside myLocalScope', myVar);
}
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope
console.log('outside myLocalScope', myVar);

Hi @alysson.campos96.
Please assign a value to myVar, and don’t change any other thing as instructed. Then submit.

var myVar = “foo”;

instead of just declaring as var myVar;