r/javascript • • Mar 09 '15

Things every JavaScript developer should know

http://ilikekillnerds.com/2015/03/things-every-javascript-developer-should-know/
326 Upvotes

118 comments sorted by

View all comments

Show parent comments

3

u/[deleted] Mar 09 '15

Thanks for this. All the more reason to avoid bind.

0

u/cosinezero Mar 09 '15

Oh, I can name you a few times it's worth using bind. Currying, for instance. But you should avoid bind unless you need it. Simply using it to permanently set scope is not a good usage; use an anonymous call (apparently not apply!!) for that.

It is strange that apply is slow; I would think that would be optimized better than call.

0

u/[deleted] Mar 09 '15

It completely agree it is definitely worth using bind to ensure that this is commonly understood and doesn't get lost. If you don't use this, though, you don't need bind.

1

u/cosinezero Mar 09 '15

Er, currying. Doesn't necessarily require use of this, but used to bind a parameter value to a function.

See http://kishorelive.com/2012/02/06/currying-in-javascript-using-bind/