Response is given when we are calling parameter which is defined inside the function although it should be undefined

Tell us what’s happening:

Your code so far


function myLocalScope() {
'use strict'; // you shouldn't need to edit this line
var myVar = 5;
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 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36.

Challenge: Local Scope and Functions

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

Does this thread answer your issue:

1 Like