In JavaScript, functions are simply objects that can be invoked. So what is the easiest way for the body of a function to reference the actual function object?
this
can be used to reference the containing object that a function (or more specifically, a method) is called from. But I believe this
never refers to the actual function object itself.
Obviously, bind
, call
, or apply
could be used to change the value of this
for the function. Or bind
could be used to create a version of the function that is always given a reference to itself as its first parameter.
But is there any simpler way? I suspect not, but I could be wrong.