What is the difference, why make sure to go through call.
We know that call is used to change the scope of the function, and Object.prototype.toString.call is used here to change the scope.
Object.prototype.toString () When the ToString method is called, performs the following steps (refer to):
1. Gets the value of the [[Class]] property of this object.
2. Calculated three string "[object", the first step of the operation result (1), and "]" after the connection of the new string.
3. Returns the result of the operation of the second step (2).
[[Class]] is an intrinsic property, and all objects (native and host objects) have that property. In the specification, [[class]] is defined: The internal property describes a string value that indicates the type of the object.
The process is simple: 1. Gets the class name (object type) of the object. 2. Then combine [object, acquired class name,] and return.
The key place to use call is in the 1th step, get the This object, no call change scope when this point is window Ah!
Also, why do we have to use the top-most object.prototype of the prototype chain, rather than just using the data type object, because when I find the ToString method on the prototype chain, I don't find the object.
, the ToString method of its own object has been found, and this method has rewritten object.
JS exactly determine why the data type is using Object.prototype.toString.call () instead of Object.prototype.toString ()