// 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:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36 OPR/54.0.2952.54.
You don’t need to declare a variable called myOutfit. The instruction just says add a local variable to myOutfit function. Follow the given example, re-delcare outerWear variable with value of sweater
// 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();
I have don:
var myOutfit = “sweater”
var outerWare = " sweater"
myOutfit = “sweater”
outerWare = “sweater”
changer the t shirt
changed the last myOutfit & tried adding sweater to it which it said not to do
sweater by itself
Are you sure? If you edit the code outside of the allowed part the tests are not going to work and you are not able to pass the challenge. Still, this is not what the challenge asks for…
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.
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…)