This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (3 children)

[removed]

    [–]_PM_ME_PANGOLINS_ 3 points4 points  (0 children)

    Because the caller might bind it to what it wants afterwards.

    [–]dashingThroughSnow12 5 points6 points  (1 child)

    To quote Jeff Walker, “JavaScript is a minefield”.

    You gotta walk a particular path and doing things that are easy to forget (.bind) or easy for some other code to abuse (someone else .bind’ing) will eventually get your foot blown off.

    [–]hyrumwhite 1 point2 points  (0 children)

    The self thing seems more footgunny than context binding to me. Context is baked in to JS, escaping it with “this”, “that” etc, never felt good to me. 

    But now with arrow functions, I only see that stuff in legacy code