JavaScript 中是否存在不是构造函数的函数? IE。以下行将导致类型错误:
var a= new foo(); //foo is not a constructor
换句话说,我想知道以下内容:
是否存在没有[[Construct]]
内部属性的函数?
最佳答案
是的,有:
> new window.open()
TypeError: window.open is not a constructor
> new parseInt(123)
TypeError: parseInt is not a constructor
其他一些内置函数可能会给出相同的结果。
关于javascript - JavaScript 中的构造函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24117600/