Global Scope and Function Charlene

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(myGlobal){
  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;
 }
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:

Do you have a question?

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

function fun1(myGlobal){
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;
}
oopsGlobal.log(output);
}
console.log(output);

Do you have a question?

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