Global vs. Local Scope in Functions - wrong?

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

Not really understanding your question. The code you post above under Your code so far passes all the tests for this challenge.

try switching your browser to google chrome…

that’s correct, someVar outside the function is different from the one inside the function. the console.log outside the function has access only to the variable outside the function.

if you want to print to the console the one inside the function you need to call the function and add a console.log inside the functionc