标签:http io ar sp java div on cti bs
下面有四道简短的JavaScript小脚本,如果你能顺利预测脚本的运行结果,那么你的JavaScript基本功还是可以的。如果答错了,可以相应地去补一下缺漏的知识。反正也很简单,答错了只是说明你没了解而已,看下资料很快就会明白。那么先做吧,要看答案请点 runcode 按钮。郸城县殳海环保
1 |
var a = 10; |
2 |
sayHi(); |
3 |
function sayHi() { |
4 |
var a = 20; |
5 |
alert(a); |
6 |
} |
7 |
alert(a); |
1 |
var a = 10; |
2 |
sayHi(); |
3 |
function sayHi() { |
4 |
a = 20; |
5 |
alert(a); |
6 |
} |
7 |
alert(a); |
01 |
var a = 10; |
02 |
sayHi(); |
03 |
function sayHi() |
04 |
{ |
05 |
a = a + 10; |
06 |
alert(a); |
07 |
return a; |
08 |
} |
09 |
alert(a); |
10 |
alert(sayHi()+10); |
01 |
var a = 10; |
02 |
sayHi(); |
03 |
function sayHi() |
04 |
{ |
05 |
var a = a + 10; |
06 |
alert(a); |
07 |
return a; |
08 |
} |
09 |
alert(a); |
10 |
alert(sayHi()+10); |
标签:http io ar sp java div on cti bs
原文地址:http://www.cnblogs.com/xiaoyang002/p/4101604.html