Has a huge bug, please help!

Tell us what’s happening:
Describe your issue in detail here.
Could someone helps?

Output:
// running tests

myGlobal

should be defined

myGlobal

should have a value of

10
oopsGlobal

should be a global variable and have a value of

5

// tests completed // console output ReferenceError: oppsGlobal is not defined ReferenceError: oppsGlobal is not defined
Your code so far


var myGlobal = 10;


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

// 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_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36

Challenge: Global Scope and Functions

Link to the challenge:

Not a huge bug, just a typo:

oppsGlobal = 5;

should be oopsGlobal

2 Likes

Oh, thanks a lot! Saved my headache. :grinning:

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