Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么下面的 JavaScript
Math instanceof Math
抛出错误
TypeError: Expecting a function in instanceof check, but got #<Object>
?
因为Math不是构造函数,不像Object.
Math
Object
见instanceof:
instanceof
句法 object instanceof constructor 参数 object:要测试的对象。 constructor: 要测试的函数
object instanceof constructor
object:要测试的对象。
object
constructor: 要测试的函数
constructor