JS如何判断字符串是以指定字符串结尾

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" ))
相关文章
相关标签/搜索