From what I understand, the former will:
- Find the
toStringmethod on Object - call it on
valuebut withthisbound tovalue
And value.toString() will.
- Find the
toStringmethod somewhere invalue's prototype chain - Call
toStringon value bound withthisas value via the function invocation pattern
So the difference is if there is an overridden toString method in value... it will use that.
My question is:
- Is that the only difference?
- Conversely, is this pattern the standard pattern to use if we want to be guaranteed we're calling
Parent's method and not potentially some overridden byChild? (In this case Parent = Object, Child = the class value comes from, if we're thinking classically, and method = toString.)