S.Hale 3920b7c4ce Corrected capitalization, corrected to American spellings and typos (#30685)
* Translate challenge subtitles and example challenge text to Spanish

* Corrected errors in syntax and punctuation

* Multiple corrections of it/s to its plus other grammar corrections

* Correction and added paragraph to CSS Flex article

* Corrected my own typo

* Corrected capitalization, American spellings and typos
2018-11-07 10:34:13 -05:00

937 B

title
title
Global vs. Local Scope in Functions

Global vs. Local Scope in Functions

Remember that global scope means that the variable is available throughout the entire code. Local scope, means that the variable is available within a certain range.

In this exercise, you have an outerWear variable in global scope with "T-shirt" as its value. You should now create another variable named outerWear, but this time within the function myOutfit(). The basic code solution is as follows:

var outerWear = "T-shirt";

function myOutfit() {
  var outerWear = "sweater";
  return outerWear;
}

myOutfit();

The function will return the closest outerWear it can find. Since we created an outerWear inside the function, that is the 'closest', so the function will return "sweater".