I have tried everything. Help!

Tell us what’s happening:
Describe your issue in detail here.
I feel like my code is correct but for some reason, it does not return “Sweater”. Can someone please help me

  **Your code so far**

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

function myOutfit() {
// Only change code below this line
var outerWear="Sweater";
// Only change code above this line
return outerWear;

  **Your browser information:**

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

Challenge: Global vs. Local Scope in Functions

Link to the challenge:

myOutfit should return the string sweater.

Capitalization matters.

Side note, don’t use var.


Thank you!!! I just passed the challenge. I appreciate your help

Can you tell me why var did not work but const worked?

var just has messy scope rules and is best avoided.

1 Like

Thank you :slight_smile: I changed “Sweater” to “sweater” and used const. instead. Thank you.