Globle Scope and Function

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

   **Your code so far**

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

function fun1(myGlobal){

var 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;
 }
oopsGlobal.log(output);
}
console.log(output)
   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.82 Safari/537.36

Challenge: Global Scope and Functions

Link to the challenge:

Can someone assist. Iis there something wrong with this code?

Per the challenge:

Inside function fun1 , assign 5 to oopsGlobal without using the let or const keywords.

It’s telling you to not declare the variable just assign it

Also.

  1. You have changed code below the comment // Only change code above this line. It may be easier to reset the challenge to get the original code back (or you can fix it if you understand the errors).

  2. The variable name should be oopsGlobal and not oppsGlobal.

Thanks, I reset it, and it worked.

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