Local Scope and Functions NOT-WORKING

Tell us what’s happening:

Your code so far


function myLocalScope() {
  'use strict'; // you shouldn't need to edit this line
  myVar ();
  console.log(myVar);
}
myLocalScope();

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

myVar();
// Now remove the console log line to pass the test

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:61.0) Gecko/20100101 Firefox/61.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions

myVar is not a function. Just define the variable. You can put a string or number in it.

var myVar = 'this is a string';

i just added it and it keep on telling me that

assignment to undeclared variable myVar

Note the 'use strict' in the first line – this requires that variables be defined with the keyword var (so it will fail if you don’t include var, or if you try to use let or const to define your variable).

So the line where you initialize the variable myVar – does it look like

var myVar = "foo";

or does it look like

myVar = "foo";

?