You should add a local myVar variable

Tell us what’s happening:

Greetings, Campers!

I’m facing some difficulties while trying to add a local variable to a function.

Would some caritative soul lend me a hand to get this test passing?

Your code so far


function myLocalScope() {
'use strict';

// Only change code below this line
var myVar = "Hello";
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:

Your code looks right. So what is the problem here.

Greetings @Catalactics,

Thank you for your fast reply.

Indeed, it looks right. However, the test isn’t passing.

Can you give me a screenshot of the test or what the console says

The console will display an error but that is intended. Your code passes when i try submitting it. However if yours isn’t passing, try submitting using another browser.

Sure, here it goes:

Any help or hint about what could be going on will be highly appreciated.

It all looks right to me, can you maybe reset all the code and maybe re-do it, because its easy to do. If it still shows a problem you can ask again

1 Like

Try using another browser. I think the problem is browser related. Somebody had a similar difficulty today.

3 Likes

Thank you both, I got it working on Chrome, but not on Firefox!