From what I understand, the former will:
- Find the
toString
method on Object - call it on
value
but withthis
bound tovalue
And value.toString()
will.
- Find the
toString
method somewhere invalue
's prototype chain - Call
toString
on value bound withthis
as 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.)