Basic JavaScript - Global Scope and Functions

Tell us what’s happening:
Describe your issue in detail here.
Can anyone help me I Have just done this as per the hint…

Your code so far

// Declare the myGlobal variable below this line


function fun1() {
  // Assign 5 to oopsGlobal here

}

// Only change code above this line

function fun2() {
  let 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:109.0) Gecko/20100101 Firefox/110.0

Challenge: Basic JavaScript - Global Scope and Functions

Link to the challenge:

I don’t see where you have declared the myGlobal variable below the comment.

Hi, the instruction say that you should add myGlobal var between the comments:
// Declare the myGlobal variable below this line
// Only change code above this line

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