Javascript bind and additional parameters
What is the behaviour of bind()? Does it allow adding extra parameters when calling the bound function?
by kaspervandenberg
JavaScript
function f(parToBeBound, remainingPar) {
$('main').append("<section><h>f() was called:</h>\
<table>\
<tr><th>parToBeBound</th><td>" + parToBeBound + "</td></tr>\
<tr><th>remainingPar</th><td>" + remainingPar + "</td></tr>\
</table>")
}
f("explicit call", "1");
var bf = f.bind(null, "Bound val");
bf();
bf("2");
var bf2 = f.bind(null, "Second bound val");
bf2();
bf2("3");