0

I have a function and I am binding its parameter using bind() method. Can we remove this binding later on ?

function my_func(a, b){ 
    console.log("Parameter1: ", a);  
    console.log("Parameter2: ", b);
}

my_func(1,2); // Calling 1
Parameter1:  1 // result 1
Parameter2:  2 // result 1

my_func = my_func.bind(null, "Deepak");

my_func(1,2); // Calling 2
Parameter1:  Deepak // result 2
Parameter2:  1 // result 2

my_func = my_func.bind(null, "Dixit");

my_func(1,2); // Calling 3
Parameter1:  Deepak // result 3
Parameter2:  Dixit // result 3

Now I want to get result in such way that result of Calling 1 should be same as Calling 3. In simple words I want to remove the binding. Is there any way ?

Edit 1 I checked this question and I came to know that there is no way to get original function back ? It is correct ?

Deepak Dixit
  • 1,510
  • 15
  • 24

0 Answers0