我過不了全局作用域和函數,請各位大大幫忙一下!

// 在这行下面声明 myGlobal 变量

let myGlobal = 10;

function fun1() {

// 给 oopsGlobal 赋值 5
var oopsGlobal = 5;
Many Thanks !
hwapipi

var oppsGlobal = 5;

}

please provide the link to the challenge so people can assist you

O.K. Now,I link to the challenge.Many Thanks !

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() {
// Assign 5 to oopsGlobal Here
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;
}
console.log(output);
}

Many Thanks !
hwapipi

  **Your browser information:**

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

Challenge: Global Scope and Functions

Link to the challenge:

Two issues

No.1:
The directions say to use let or const here

No.2:
You have a spelling error.

This is incorrect

Reread the directions for the correct name to use there and the test will pass

Directions: Inside function fun1 , assign 5 to oopsGlobal

Dear Miss J.:
Many thanks ! I passed !

1 Like

Also, we do have a chinese forum if you want to post questions in there and receive responses in chinese

1 Like

Thanks for mentioning this Chinese forum. There’s a notice on the top saying we have moved to a new location, i.e. this subforum. So we’ll gradually see more Chinese posts here:)