So how can we tell if two bound functions are reflectively equal? Arjun came up with the brilliant idea of simply storing the original function, context, and remaining arguments as properties on the bound function instance. By comparing these three fields, we can determine if two functions are reflectively equal. This was then implemented by Blake:
First, let’s take a look at
Function.prototype.bind. Given a function
fn, it is safe to assume that if
fn.bind is called twice with the same context (thisArg) and arguments, then the two resulting function instances are behaviorally equivalent, or what we call “reflectively equal”.