[英]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.