Echo JS 0.11.0

<~>

kameron 2889 days ago. link 1 point
Why not .call(myObject) instead of .bind(myObject)()???
mephju 2893 days ago. link 1 point
I never do this. If I need access to an object within a function I bind it as a param. I think this is much easier to reason about: fn.bind(null, myObject). If you use classes only sparingly there is no reason to ever change a function's context.
MaxArt 2892 days ago. link 2 points
bind gives us the basics of function currying, and while the same can be achieved with a higher order function, it's indeed nice to have it natively.

In JavaScript you should generally avoid the keyword this, but in some cases it makes sense. It's usually when we're dealing with component objects (ugh, so often in JSX).
xat 2893 days ago. link 2 points
Guess it depends on the situation. For example, Vue.JS binds methods to the instance of the component. That is a case where passing in the component instance as first parameter into the method would feel strange (at least to me).
xat 2894 days ago. link 1 point
Actually you can't use bind in combination with arrow-functions. The sample code will therefor always output 'undefined'.

EDIT: example has been fixed.