Global vs Local Scope in Functions?

Global vs Local Scope in Functions?
0

#1

Tell us what’s happening:

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;
}

myOutfit();

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0.

Link to the challenge:


#2

Variable within the function needs to have same name as the one outside the function
so var myOutfit="sweater"; to var outerWear="sweater";