var myObject = {
foo: "bar",
func: function() { var self = this;
console.log(this.foo);
console.log(self.foo);
(function() {
console.log(this.foo);
console.log(self.foo);
}());
}
};
myObject.func();
程序的输出是什么?
Abar bar bar bar
Bbar bar bar undefined
Cbar bar undefined bar
Dundefined bar undefined bar
相关试题
-
var myObject = { foo: bar, func: function() { var self = this; console.log(this.foo); console.log(s
-
JS 程序的输出是什么: function Foo() { var i = 0; return function() { console.log(i++); } } var f1 = Foo(),
-
function Foo(){ var i=0; return function(){document.write(i++); } } var f1=Foo(), f2=Foo(); f1();
-
以下代码执行后的输出结果为:var cnt = 0;function myTest(){ cnt;}console.log(cnt);
-
如下代码输出的结果是什么: console.log(1+ 2+2); console.log(1+ +2+2); console.log(A- B+2); console.log(A- B+2);