【发布时间】:2019-03-13 02:46:22
【问题描述】:
当我在 IE11 中尝试 this.form.name.endsWith("$END$") 时,出现以下错误。
Object doesn't support property or method 'endsWith'
在 Chrome 中,它工作正常。 IE11中是否有任何替代字符串方法
【问题讨论】:
-
String.prototype.endsWith = "".endsWith || function(s){return !this.split(s).pop();}; -
供将来参考...查看 MDN 文档 - 它会告诉您现代 javascript 方法是否与尼安德特人浏览器兼容
标签: javascript browser internet-explorer-11