var foo = '123';function print() { this.foo = '789'; console.log(foo);}print();
举一反三
- 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
- 以下代码执行后, num 的值是多少?var foo = function(x, y) {return x - y;};function foo(x, y) {return x + y;}var num = foo(1, 2);console.log(num);
- def foo(): y = "local" foo() print(y)
- varmyObject={foo:"bar",func:function(){varself=this;console.log(this.foo);console.log(self.foo);(function(){console.log(this.foo);console.log(self.foo);}());}};myObject.func();程序的输出是什么? A: barbarbarbar B: barbarbarundefined C: barbarundefinedbar D: undefinedbarundefinedbar
- Which of the following are NOT valid if/else statements in Python, assuming x and y are defined appropriately: A: if x < y: print('foo') else: print('bar') B: if x < y and x > 10: print('foo') C: if x < y: print('foo'); print('bar'); print('baz') D: if x < y: print('foo') elif y < x: print('bar') else: print('baz')