String.prototype.endWith=function(endStr){ //判断字符串以 endStr 为结尾 let d=this.length-endStr.length; return (d>=0&&this.lastIndexOf(endStr)==d); }