What am I doing wrong here ? I cant find the right solution

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

// Declare the myGlobal variable below this line
var myGlobal = 10;

function fun1() {
// Assign 5 to oopsGlobal Here
oopsGlobal = 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 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0

Challenge: Global Scope and Functions

Link to the challenge:

If you go back and read the directions carefully I think you will see the error. You are using the deprecated var to declare your variable, try using let or const keywords instead. Hope this helps

I also suggest you look back at the list of challenges, you may find there is something new in there

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