Variables with a global scope can be accessed anywhere using JavaScript code.
Variables which are declared without the var keyword are automatically created in the global scope.
Final Code
// Declare the myGlobal variable below this linefunctionfun1(){// Assign 5 to oopsGlobal HereoopsGlobal=5;}varmyGlobal=10;// Only change code above this linefunctionfun2(){varoutput="";if(typeofmyGlobal!="undefined"){output+="myGlobal: "+myGlobal;}if(typeofoopsGlobal!="undefined"){output+=" oopsGlobal: "+oopsGlobal;}console.log(output);}