function.prototype.bind=function(obj){ var arg=array.prototype.slice.call(arguments,1); var context=this; var bound=function(){ arg=arg.concat(array.prototype.slice.call(arguments)); return context.apply(obj,arg); } var f=function(){} f.prototype=context.prototype; bound.prototype=new f(); return bound; } function read(name, time, book) { console.log(`${name} is reading ${book} at ${time}`) } var tomread = read.bind(this, 'tom', 'morning') tomread('<万历十五年>') console.log(tomread.bind)
您可能感兴趣的文章:
如您对本文有疑问或者有任何想说的,请 点击进行留言回复,万千网友为您解惑!
网友评论