function show(){
    console.log(this.name);
}
show.bind({name:"houdunren"})();//加了(),因为不是立即执行函数
function show(){
    // this.name=name;
    console.log(this.name);
}
show.bind({name:"houdunren"})();//加了(),因为不是立即执行函数

let a=function(){}
let b=a;
console.log(a===b);//true
let c=a.bind();//重新复制了一份函数
console.log(c===a);//false
function hd(a,b){
    console.log(a,b);
    return this.f+a+b;
}
// let fuc=hd.bind({f:1},1,2);//1,2
let fuc=hd.bind({f:1},1);//1,3
fuc(3,4);
<button>后盾人</button>

document.querySelector("button").addEventListener("click",function(event){ document.write(this.url+event.target.innerHTML); }.bind({url:"houdunren.com"}))

 

posted on 2022-01-19 22:39  weakup  阅读(37)  评论(0编辑  收藏  举报