Global vs. Local Scope in Functions!

Tell us what’s happening:
Describe your issue in detail here.

please help me fix my error // Setup
var outerWear = “T-Shirt”;

function myOutfit() {
// Only change code below this line

var myOutfit = “sweater”;

// Only change code above this line
return outerWear;
}

myOutfit();
Your code so far


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

function myOutfit() {
// Only change code below this line

var myOutfit = "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:

Add a local variable to myOutfit function to override the value of outerWear with the string sweater .

It looks like your variable name does not match the required variable name.

1 Like

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