挺有意义的javascript面试题

author Owner  •  Filed under templates, internet

function _extend(sub,sup){}

function A(){}

function B(){}


_extend(B,A);

var b=new B();

console.log(b instanceof A);


var c='o',fn;

var test = {a:{c:'a',b:function(){console.log(this.c)}},b:function(){console.log(this.c)},c:'i'};


1、(test.a.b)();//输出结果

2、(fn = test.a.b)();//输出结果

3、test.b(); //输出结果,在不改写源代码,使得test.b()输出new-i

4、test.b.call(test.a);////输出结果



var a='1',b={a:"2"};

function show(){console.log(this.a);}.bind(b);

show();

5、实现Function的bind方法,使show();输出成立

Tagged: orci, lectus, varius, turpis

Comments (0)  • 2016-05-11 13:47:57 •  Edit

0 Responses

最新文章