Local Scope and Functions5

Tell us what’s happening:

Ok not sure what the problem here is? I tried taking out the console.log lines.

Your code so far


function myLocalScope() {
  'use strict'; // you shouldn't need to edit this line
  
  var myVar = "foo";

  console.log(myVar);
}
myLocalScope();

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

// 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/67.0.3396.99 Safari/537.36.

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

the test is not expecting you to assign “foo” to the variable.

just declare myVar and then when you see the error that myVar is not found , delete the console.log statement and submit

1 Like

var myVar

(myVar);

This is still wrong?

Remove the line with the brackets (myVar)
And add a semicolon at the end of the first line.