Global Vs Local Scope in Functions Help

Global Vs Local Scope in Functions Help
0

#1

Continuing the discussion from freeCodeCamp Challenge Guide: Global vs Local Scope in Functions:

I cannot find the answer to this problem!

Would someone please help me?


#2

What is your question? What have you tried? What don’t you understand? What is working differently than you expect it to?


#3

I tried this and…

// 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();

#4

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


#5

What do the failing tests say? What is happening that is different from what you expect?


#6

var outerWear = “T-Shirt”;

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

var outerWear = “sweater”;

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

myOutfit();


#7

that worked for me thank you very much