After commenting the last line still getting an error
You should add a local myVar variable. Your code so far
function myLocalScope() {
var myVar='use strict';
// Only change code below this line
console.log('inside myLocalScope', myVar);
}
myLocalScope();
// Run and check the console
// myVar is not defined outside of myLocalScope
// console.log('outside myLocalScope', 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.
Please use the “preformatted text” tool in the editor (</>) to add backticks around text.
function myLocalScope() {
'use strict';
// Only change code below this line
console.log('inside myLocalScope', myVar);
}
myLocalScope();
// Run and check the console
// myVar is not defined outside of myLocalScope
console.log('outside myLocalScope', myVar);
You should declare a variable myVar just below the Only change code below this line.