Tell us what’s happening:
This is not returning “sweater” and neither the code
var someVar = “Hat”;
function myFun() {
var someVar = “Head”;
return someVar;
}
is not returning Head, if i do a console.log(someVar) - > results Hat
Your code so far
// 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();
console.log(outerWear)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/global-vs--local-scope-in-functions