When i tried to run test it says ,You should add a local myVar variable. i dont know what am i doing wrong?

Tell us what’s happening:

Your code so far



function myLocalScope() {
var myVar = 5;


 // Only change code below this line

 console.log('inside myLocalScope', myVar);
}
myLocalScope();

// 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36.

Challenge: Local Scope and Functions

Link to the challenge:

var myVar = 5;


 // Only change code below this line

The comment tells you where it is supposed to be. I understand that functionally it is the same, but part of being a developer is noticing and following tiny details.

When I change that, the code passes for me.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.