Global vs. Local Scope in Functions error

Tell us what’s happening:

Referring to line 13 of your code: , and I have marked it with //*********************************************
console.log(myOutfit());
is not what appears in the lesson. Line 13 in the lesson only consists of:
myOutfit();
missing the console.log part of the Output display method. The user story only asks for a variable to be added:
outerWear=“sweater”;
and does not mention the Output display method.
When I RUN THE TESTS it still works, but it won’t work in my local environment because the
console.log
part is missing from the Output display method.
Your code so far


// Setup
var outerWear = "T-Shirt";

function myOutfit() {
// Only change code below this line
outerWear="sweater";


// Only change code above this line
return outerWear;
}
//*********************************************
console.log(myOutfit());
//*********************************************
  **Your browser information:**

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

Challenge: Global vs. Local Scope in Functions

Link to the challenge:

What is returned by myOutfit function is not a concern here. What matters is if outerWear variable in the global scope changes or not. Using something like below might get some more insights if function affects it.

console.log(outerWear);  // outerWear before calling function
myOutfit();
console.log(outerWear); // outerWear after calling function