DEV Community

Discussion on: Use bind to assert a function throws error

Collapse
 
oysmal profile image
Øystein Malt

It wouldn’t in this case, as the function tested would retain its scope. It is functionally the same if you intent to bind the function to itself. In fact bind returns a new function (so you get 2 functions here as well), which is good to remember if using it with e.g. React event handlers (referential equality changes) 😊