Basic JavaScript - Global Scope and Functions

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:103.0) Gecko/20100101 Firefox/103.0

Challenge: Basic JavaScript - Global Scope and Functions

Link to the challenge:

Hey! whenever you’re stuck on a problem , your first reaction should be to take a look at the instructions that you’ve been given to make sure you’re doing exactly what the challenge asks you to do.

After you’ve done that, the next place you should be looking at is the hints.

This is the hint that shows up when i try to run your code.

Screenshot from 2022-08-27 12-55-25

According to this, your new variablle should be declared using the let or const keyword and it looks like you didn’t do that which is causing the issue.

Hope this helps! :smile: