Global Scope and Functions 2018

Tell us what’s happening:
This solution is not enough its stating that oppsGlobal does not have a value of 5 which I already placed in function fun1()

Your code so far

var myGlobal=10;// Declare your variable here


function fun1() {
  oppsGlobal=5;// Assign 5 to oopsGlobal Here
  
}

// 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:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/global-scope-and-functions

1 Like

oopsGlobal, not oppsGlobal

Thanks! Missed that typo!