查看一下代码 ,请问输出正确的是|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
A: test test undefined test
B: test undefined undefined test
C: test test undefined
D: test test test test
举一反三
- 指出代码输出的各个结果: console.log(test); function test(test){ console.log(test); var test=234; console.log(test); function test(){} } test(1); var test=123;
- 以下代码片段的输出结果为( ). [script type="text/javascript"] var foo =1; function Test(){ alert(foo); var foo=2; alert(foo); } Test(); </script A: 1,2 B: 2,1 C: 1,undefined D: undefined,2
- var a = 10; function test() { console.log(a); var a = 100; console.log(a); } test(); console.log(a);
- 以下代码片段的输出结果为( ). [script type="text/javascript"] var foo =1; function Test(){ alert(foo); var foo=2; alert(foo); } test(); </script A: 1,2 B: 2,1 C: undefined,2 D: 没有任何结果
- 145.var t = 10; function test(test){ t = t + test; console.log(t); var t = 3; } test(t); console.log(t); 运行结果是( )?