gpt4 book ai didi

JavaScript 错误 :Object doesn't support this property or method in IE Browser

转载 作者:行者123 更新时间:2023-11-28 01:43:08 24 4
gpt4 key购买 nike

我有javascript验证方法,它在firefox中运行良好,但在IE浏览器中不起作用。我收到错误,因为对象不支持此属性或方法。请告知..

function validateChunk(s)
{
return !!s.match(/^[a-z]+(?:\(\d+\))?$/);
}

function filterValid(v)
{
return !v;
}

function testCases(str)
{
var chunks = str.split(",");
var validated = chunks.map(validateChunk);
return (0 === validated.filter(filterValid).length);

}

jsfiddle

最佳答案

IE8 没有 .map().filter()

您可以在 MDN 网站上找到用于填写它们的代码:

关于JavaScript 错误 :Object doesn't support this property or method in IE Browser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20642483/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com