為什么要用Object.prototype.toString而不是Function.prototype.toString或者其它?這是和他們的toString解釋方式有關系的。下面是ECMA中對Object.prototype.toString的解釋:
When the toString method is called, the following steps are taken:
1. Get the [[Class]] property of this object.
2. Compute a string value by concatenating the three strings “[object “, Result (1), and “]”.
3. Return Result (2)
新聞熱點
疑難解答