Function.prototype.bindq = function(objThis){
if(typeof this !== 'function'){
throw Error(`需要函数才能绑定`)
}
let that = this
let args = Array.prototype.splice.call(arguments,1);
let fun = function(){
let a= args.concat(Array.prototype.splice.call(arguments,0))
//可使用手写的apply函数
that.apply(objThis,a)
}
return fun
}
var a = {x:200}
function test(a,b,c){
console.log("this.x")
console.log(this.x)
console.log(a)
console.log(b)
console.log(c)
}
var aa = test.bindq(a,3,99)
aa(2,4,8,6)
//输出-----------
//this.x
//200
//3
//99
//1