扩展ie中不兼容的startsWith,endsWith方法

/**
*扩展ie中不兼容的startsWith,endsWith方法
*/
String.prototype.startsWith = String.prototype.startsWith || function (str) {
var reg = new RegExp("^" + str);
return reg.test(this);
}
String.prototype.endsWith = String.prototype.endsWith || function (str) {
var reg = new RegExp(str + "$");
return reg.test(this);
}

原文来自于:
https://blog.csdn.net/u010999809/article/details/103688604
原文地址:https://www.cnblogs.com/sherryweb/p/12600311.html