Bad instructions or is it just me?

So basically the instructions says to put it into the function fun() but when I did that ( using var oopsGlobal = 5;,
the answer was wrong I was confused so I tried to put it out the function and it passed the test. I am wondering why the instructions said to put it into the function when it dosent work? is it because I misread it or got soemthing wrong or???

  **Your code so far**

// Declare the myGlobal variable below this line
let myGlobal = 10;
var oopsGlobal = 5;
function fun1() {

}

console.log(oopsGlobal)

// Only change code above this line

function fun2() {
var output = "";
if (typeof myGlobal != "undefined") {
  output += "myGlobal: " + myGlobal;
}
if (typeof oopsGlobal != "undefined") {
  output += " oopsGlobal: " + oopsGlobal;
}
console.log(output);
}
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36

Challenge: Global Scope and Functions

Link to the challenge:

You are still using a variable declaration keyword. You shouldn’t ever be using var, so that isn’t an option. Try putting oopsGlobal inside of fun1() without var, let, or const.

1 Like

Gotcha, thanks that helped tremendously! :sweat_smile:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.