What else needs to be done?

Tell us what’s happening:

  **Your code so far**

function myLocalScope(myVar) {
myVar = "mango";
// 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 add local ‘myVar’ variable; but wright " The code should not contain a global myVar variable.

You should add a local myVar variable."
what else needs to be done?

  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36.

Challenge: Local Scope and Functions

Link to the challenge:

I decided. needed to write the variable after the line “// Only change code below this line”

declare it, do not initialize it

Yes @ilenia is right

Declare it, do not initialize it

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.