参考地址
代码
String.prototype.endWith = function (endStr) {
var d = this.length - endStr.length;
return (d >= 0 && this.lastIndexOf(endStr) == d);
}
调用
var str="I love antzone";
console.log(str.endWith("ne"));
2022-10-14 16:58:38
String.prototype.endWith = function (endStr) {
var d = this.length - endStr.length;
return (d >= 0 && this.lastIndexOf(endStr) == d);
}
var str="I love antzone";
console.log(str.endWith("ne"));