Global vs. Local Scope in Functions "I tried" but need Help[

Global vs. Local Scope in Functions "I tried" but need Help[
0
#21

Don’t make an habit of changing code outside of the allowed part, more often than not it will not work.

You are not doing what the challenge asks from you which is creating a local variable of the same name of a global variable, to understand how global vs local scope works.

0 Likes

#22

// Setup
var outerWear = “T-Shirt”;

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

var outerWear = “sweater”;

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

myOutfit();

it’s working to. Global variable is still “T-Shirt” and locally variable is now new

0 Likes

#23

That is the right answer.

He other one works because the tests can’t predict everything you will do and you can find “solutions” that will let you pass the tests anyway


If you want to help, it is better to give hints and pointing errors instead of the answer so that other people can also learn how to solve problems. It is difficult to learn something new if you have a solution to copy and paste (and if someone wants that they can go to the Hint section…)

0 Likes

#24

if u click on a hint u will get error 404 page not found

0 Likes