简体   繁体   English

TypeError:未定义不是函数。 iOS Safari评估功能。 CoffeeScript

[英]TypeError: Undefined is not a function. iOS Safari Evaluating function. CoffeeScript

I'm getting an error on iOS safari when trying to evaluate if there is a match within an array with at regex string. 尝试评估at regex字符串数组中是否存在匹配项时,iOS Safari浏览器出现错误。

The Code: this.productArray = ['array', 'with', 'stuff'] 代码:this.productArray = ['array','with','stuff']

this.splittedString = string.split('/(\\n\\r|\\r\\n)|( )/igm') this.splittedString = string.split('/(\\ n \\ r | \\ r \\ n)|()/ igm')

    _.each this.splittedString, (word, index) =>
        for word of this.productArray
            if this.splittedString[index].includes(this.productArray[word])
                this.pushToArray('matchedProducts', this.productArray[word])

It works without problem on Chrome but iOS safari get's an TypeError with: 它可以在Chrome上正常工作,但iOS Safari浏览器会出现TypeError错误:

TypeError: undefined is not a function (evaluating '_this.splittedString[index].includes(_this.productArray[word])') TypeError:未定义不是函数(评估'_this.splittedString [index] .includes(_this.productArray [word])')

which is super strange. 超级奇怪 And I just can't figure out the error. 而且我无法弄清错误。 Thanks. 谢谢。

includes字符串方法是ES6标准的一部分,Safari不支持它( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 'ShouldWorkController'不是一个函数。 未定义 - 'ShouldWorkController' is not a function. Got undefined 类型错误:onChangeImage 不是函数。 (在'onChangeImage(result.uri)'中,'onChangeImage'未定义)] - TypeError: onChangeImage is not a function. (In 'onChangeImage(result.uri)', 'onChangeImage' is undefined)] WordPress管理区域-TypeError:$不是函数。 (在“ $(“。tab_content”)”中,“ $”未定义) - Wordpress Admin area - TypeError: $ is not a function. (In '$(“.tab_content”)', '$' is undefined) jQuery第67行说“TypeError:'undefined'不是函数。” - jQuery line 67 saying “TypeError: 'undefined' is not a function.” react native TypeError: this.setState is not a function.'this.setState' is undefined) - react native TypeError: this.setState is not a function.'this.setState' is undefined) 获取“TypeError:res.status 不是 function。” - Getting "TypeError: res.status is not a function." 类型错误:defineCall 不是 function。 要求()失败 - TypeError: defineCall is not a function. require() fails validateLogin是一个未定义的函数。(javascript异常) - validateLogin is an undefined function.(javascript exception ) 提示返回未定义的函数。 (范围问题) - Prompt return as undefined in a function. (scope issue) 类型错误:class.function 不是函数。 (在'classname.function(param)'中) - TypeError: class.function is not a function. (In 'classname.function(param)')
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM