Https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions

Tell us what’s happening:

Your code so far


function myLocalScope() {
//'use strict';

// Only change code below this line
var myVar = "s";
console.log(myVar);
}
myLocalScope();

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

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 5.1.1; SM-J200G Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile 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

1 Like

Hello!

What is your question here? The code you’ve posted seems to work fine.

Yaa…now it has executed successfully. I don’t know why it was not executing at that time. Btw thank you

Thank you,
I was having the same problem don’t know why was the code was not running . But now it compiled perfectly.