在javascript中,执行后输出的结果是: var name="zhaonan"; var obj1={ name:"miao", age:20, say:function(){ console.log(this.name); } } var obj2={ name:"xue", age:30, say:function(){ console.log(this.name); } } var f=obj2.say; console.log(f()); var e=f.bind(obj1); console.log(e()); var k=e.bind(obj2); console.log(k());
A: zhaonan zhaonan miao
B: zhaonan miao miao
C: zhaonan miao xue
D: miao zhaonan xue
A: zhaonan zhaonan miao
B: zhaonan miao miao
C: zhaonan miao xue
D: miao zhaonan xue
举一反三
- 在 javascript 中,执行后输出的结果是():var name="zhaonan";var obj1={name:"miao",age:20,say:function(){console.log(http://www.wendangku.net/doc/3446003cbc234 82fb4daa58da0116c175e0e1e54.html);}}var obj2={name:"xue",age:30,say:function(){console.log(http://www.wendangku.net/doc/3446003cbc234 82fb4daa58da0116c175e0e1e54.html);}}var f=obj2.say; console.log(f());var e=f.bind(obj1);console.log(e());var k=e.bind(obj2);console.log(k()); A: zhaonan zhaonan miao B: zhaonan miao miao C: zhaonan miao xue D: miao zhaonan xue
- 以下能够创建一个对象的是( )。 A: var obj=new Object( ) ; B: var obj=function(name){this.name=name ; }<br> var p1=new obj( "张三" ) ; C: var obj={ name : "张三" ; } D: var obj=Object.create( { name: "张三" } ) ;
- 如下代码在控制台打印结果为: var obj = {1 : 1}; var arr = [1,1]; console.log(obj + arr); A: 1 B: 2 C: [object Object]1,1 D: 1,1[object Object]
- var a = 10; { var a = 100; console.log(a)//(1) } console.log(a)//(2)
- var a = 10; function test() { console.log(a); var a = 100; console.log(a); } test(); console.log(a);