为什么下面的 JavaScript 会这样
Math instanceof Math
抛出错误
TypeError: Expecting a function in instanceof check, but got #<Object>
?
最佳答案
因为 Math
不是构造函数,与 Object
不同。
参见instanceof
:
Syntax
object instanceof constructor
Parameters
object
: The object to test.
constructor
: Function to test against
关于javascript - 为什么 Math instanceof Math 会抛出错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14537398/