Getting unsual error

Tell us what’s happening:

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);

Challenge: Local Scope and Functions

Link to the challenge:

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.

See this post to find the backtick on your keyboard.
Note: Backticks are not single quotes.

markdown_Forums

Hello and welcome to the FCC community~!

Let’s go back to the default setup:

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.

1 Like

thanks for teaching me on how to post que on forem

1 Like