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

来源:互联网 发布:green网络加速器下载 编辑:程序博客网 时间:2024/05/19 21:03
String.prototype.endWith=function(endStr){
  vard=this.length-endStr.length;
  return(d>=0&&this.lastIndexOf(endStr)==d)
}
varstr="I love antzone";
console.log(str.endWith("ne"))
0 0
原创粉丝点击