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,347
  • 1
  • 12
  • 24

0 Answers0