1 2 3 4 5 (function() { var a = b = 5; })(); console.log(b); console.log(a); 上面的输出结果:
A: 5,5
B: undefined,undefined
C: 5,undefined
D: 5,UncaughtReferenceError:aisnotdefined
A: 5,5
B: undefined,undefined
C: 5,undefined
D: 5,UncaughtReferenceError:aisnotdefined
举一反三
- 下列代码输出的结果是( )。 var a; var a = [1,2,3]; function a(a){ a[1] = 5; } a(a); console.log(a); A: [1,2,3] B: [1,5,3] C: 报错 D: undefined
- 以下代码的输出结果是: var arr=[2,8,5]; console.log(arr[3]); A: 2 B: 8 C: 5 D: undefined
- 查看一下代码 ,请问输出正确的是|var Test ={| foo:"test",| func:function () {| var self=this;| console.log(this.foo);| console.log(self.foo);| (function () {| console.log(this.foo);| console.log(self.foo);| })();| }|};|Test.func(); A: test test undefined test B: test undefined undefined test C: test test undefined D: test test test test
- var bar=123 function foo () { console.log(bar) var bar=456 console.log(bar); } console.log(bar) foo() 请问输出的结果依次为 A: 123,456,123 B: undefined,456,123 C: 123,undefined,456 D: 123,123,456
- 在Javascript中,运行下面代码的结果是( )<br/>function foo(x){<br/>var num=5;<br/>bar=function(y){<br/>return (x+y+(++num));<br/>} <br/>}<br/>console.log(foo(2));<br/>console.log(bar(10));<br/>console.log(bar(10));" A: undefined,18,19 B: 17,18,19 C: 5,18,19 D: undefined,18,18