Skip to main content
26 events
when toggle format what by license comment
Jun 7, 2022 at 12:34 comment added Jack_Hu It's important to note that bind() will take a snapshot of the context where it's first encountered during interpretation... That is to say, when JavaScript gets to the bind() function for the first time, it will take the context for this at that point! This can become tricky to troubleshoot, as the standard implementation of bind() CANNOT be altered. Once a function has been bound to another object, it will remain bound to that object, and attempting to rebind it won't work.
Sep 10, 2020 at 11:58 history edited Felix Kling CC BY-SA 4.0
deleted 12 characters in body
Sep 7, 2020 at 11:06 review Suggested edits
Sep 7, 2020 at 13:39
Aug 27, 2020 at 20:27 history edited kgangadhar CC BY-SA 4.0
edited body
Aug 16, 2018 at 4:03 history edited Felix Kling CC BY-SA 4.0
added 39 characters in body
S Jan 28, 2018 at 14:32 history suggested NomadeNumerique CC BY-SA 3.0
Corrected spelling (was "has", should be "as") in this sentence: [...] by using an anonymous function -> as <- callback / event handler and assign the object (this) to another variable [...]
Jan 28, 2018 at 13:30 review Suggested edits
S Jan 28, 2018 at 14:32
S Dec 25, 2017 at 9:41 history suggested Farzad Karimi CC BY-SA 3.0
improved syntax
Dec 25, 2017 at 7:32 review Suggested edits
S Dec 25, 2017 at 9:41
Nov 15, 2016 at 6:02 comment added Nolo @FelixKling It can be useful at times to rely on Function.prototype.call () and Function.prototype.apply (). Particularly with apply () I've gotten a lot of mileage. I am less inclined to use bind () perhaps only out of habit though I am aware ( but not certain ) that there may be slight overhead advantages to using bind over the other options.
Feb 25, 2016 at 3:16 history edited mido CC BY-SA 3.0
corrected the code...
Nov 12, 2015 at 17:16 history edited Felix Kling CC BY-SA 3.0
added 89 characters in body
Oct 1, 2015 at 18:50 history edited Felix Kling CC BY-SA 3.0
added 81 characters in body
Apr 1, 2015 at 22:15 history edited Felix Kling CC BY-SA 3.0
fix typo
Mar 19, 2015 at 15:51 comment added zzzzBov @FelixKling, it allows you to be super lazy with code like $(...).on('click', $.proxy(obj, 'function')) and $(...).off('click', obj.function).
Mar 19, 2015 at 15:47 history edited Felix Kling CC BY-SA 3.0
added 353 characters in body
Mar 6, 2015 at 9:33 history edited Felix Kling CC BY-SA 3.0
added 35 characters in body
Jan 12, 2015 at 17:08 history edited Felix Kling CC BY-SA 3.0
added information about arrow functions
Sep 12, 2014 at 15:39 comment added vol7ron Felix, I've read to this answer before but never replied. I grow concerned that people use self and that to refer to this. I feel this way because this is an overloaded variable used in different contexts; whereas self usually corresponds to the local instance and that usually refers to another object. I know you did not set this rule, as I've seen it appear in a number of other places, but it is also why I've started to use _this, but am not sure how others feel, except for the non-uniform practice that has resulted.
Jan 22, 2014 at 6:42 history edited Felix Kling CC BY-SA 3.0
added 1681 characters in body
Jan 22, 2014 at 6:37 history edited Felix Kling CC BY-SA 3.0
added 1681 characters in body
Dec 3, 2013 at 3:48 audit Low quality answers
Dec 3, 2013 at 3:49
Dec 2, 2013 at 16:06 history edited Felix Kling CC BY-SA 3.0
edited body
Dec 2, 2013 at 15:58 vote accept Felix Kling
Nov 29, 2013 at 6:20 history edited Felix Kling CC BY-SA 3.0
added 2 characters in body
Nov 29, 2013 at 6:13 history answered Felix Kling CC BY-SA 3.0