Tell us what’s happening:
What am I doing wrong here?
Your code so far
function myLocalScope() {
'use strict';
// Only change code below this line
function myLocalScope() {
var myVar = 5;
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 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36.
which was throwing it off so I deleted it and it passed.
function myLocalScope() {
'use strict';
// Only change code below this line
var myVar = 5;
console.log(myVar);
}
myLocalScope();
// Run and check the console
// myVar is not defined outside of myLocalScope
console.log(myVar);
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.