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" ))
相關文章
相關標籤/搜索