Global variable shows undefined

Hello there, I’m doing javascript and on Global Scope and Function module, given program as follows -

// Declare the myGlobal variable below this line

let 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);
}
console.log(typeof(oopsGlobal))  // my question is on this line which I wrote

when i’m printing console.log(typeof(oopsGlobal)) it showing undefined so how program getting executed on
if(typeof(oopsGlobal)!=“undefined”)

Here I have no issues completing the challenge, my question is different here. I’m asking why it’s showing undefined when i print in console.
Screenshot 2022-08-27 at 13-28-15 freeCodeCamp Challenge Guide Global Scope and Functions - Guide - The freeCodeCamp Forum

as shown in help page also, num2 = 20 (which is inside function ) and it’s global which i understood, my question is if it’s global and defined also then why showing undefined when i type
console.log(typeof(oopsGlobal))

write this line at the bottom of given code in task and check.

if something is missing, kindly guide.

yu need to call fun1 first

when you ask for help, it would be really helful if you could also include the link to the challenge