3

In my example, do bind and call achieve the same thing, it's just that bind creates a new function?

function hardBinding(a,b){
    this.a = a;
    this.b = b;
    console.log(this);
}

hardBinding = hardBinding.bind(this,a,b);
hardBinding();

function sameAs(){
    hardBinding.call(this,a,b);
}

sameAs();
paddyfields
  • 1,466
  • 2
  • 15
  • 25

0 Answers0