Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/477.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在不兼容的接收器上调用了方法RegExp.prototype.exec_Javascript - Fatal编程技术网

Javascript 在不兼容的接收器上调用了方法RegExp.prototype.exec

Javascript 在不兼容的接收器上调用了方法RegExp.prototype.exec,javascript,Javascript,最近,我在使用RegExp.prototype时遇到了一个问题。正常情况下,RegExp.prototype是一个空正则表达式,但是,我尝试在控制台中使用RegExp.prototype.test(“”),这将是错误的。为什么会显示错误 console.log(RegExp.prototype.test.toString()); //RegExp.prototype.test是本机函数 //如果要调用此函数,应新建一个Regexp console.log(新的RegExp(/^$/).test

最近,我在使用
RegExp.prototype
时遇到了一个问题。正常情况下,
RegExp.prototype
是一个空正则表达式,但是,我尝试在控制台中使用
RegExp.prototype.test(“”)
,这将是错误的。为什么会显示错误

console.log(RegExp.prototype.test.toString());
//RegExp.prototype.test是本机函数
//如果要调用此函数,应新建一个Regexp

console.log(新的RegExp(/^$/).test(“”))我知道我可以创建新的RegExp。但是为什么Array.prototype.map(function(){})不会出错。所以我对RegExp.prototype感到困扰