var x=1;function test(){ console.log(x);var x=19;console.log(x);}console.log(x);test();console.log(x);程序执行完毕,控制台依次打印x的值为:___、____、____、____
举一反三
- function a(x) { return x * 2; } var a=1; console.log(a); 执行以上代码的结果是
- var a = 10; function test() { console.log(a); var a = 100; console.log(a); } test(); console.log(a);
- 已知:var test = { x1 : [1, 2, 3, 4, 5], x2 : 'hello', x3 : { y1: false, y2: null, }}以下哪句可以在Console控制台输出y1的值? A: console.log(test.x3.y1) B: console.log(test[0].x3.y1) C: console.log(x3.y1) D: console.log(y1)
- 以下代码执行后, num 的值是多少?var foo = function(x, y) {return x - y;};function foo(x, y) {return x + y;}var num = foo(1, 2);console.log(num);
- 查看如下代码: function f1( ){ console.log(x); var x = 10; ++x; console.log(x); } f1(); 执行后的结果是 A: 程序错误 B: undefined 和 10 C: undefined 和 11 D: 10 和 11