84669 人が学習中
152542 人が学習中
20005 人が学習中
5487 人が学習中
7821 人が学習中
359900 人が学習中
3350 人が学習中
180660 人が学習中
48569 人が学習中
18603 人が学習中
40936 人が学習中
1549 人が学習中
1183 人が学習中
32909 人が学習中
function a() { alert(num); } function b() { var num=3; a(); } b(); //无效
请问a函数在b中执行时怎么获取b中定义的num?
光阴似箭催人老,日月如移越少年。
function a() { alert(b()); } function b() { return 3; } a();
局部函数可以访问全局变量,但是不能访问另一个函数的局部变量,两种变量内存位置不同。
function a() {
alert(b());
}
function b() {
return 3;
}
a();
局部函数可以访问全局变量,但是不能访问另一个函数的局部变量,两种变量内存位置不同。