Lets say I have this function:
function toy(input) {
return input + 1;
}
I want to essentially generate a function that will print 4 by binding 3 to input. So that I could call something like fn() and it will print 4.
So I tried doing:
var fn = toy.bind(3);
Then when I executed fn(), I'm not getting 4.
Do I need to use 'this' in order to make this work/Is there a way to do this without bind?
binddoesn't do what you think it does!