其他分享
首页 > 其他分享> > JS endWith原型

JS endWith原型

作者:互联网

//判定是否endWith
String.prototype.endWith = function(s) {
	if (s == null || s == "" || this.length == 0 || s.length > this.length)
		return false;
	if (this.substring(this.length - s.length) == s)
		return true;
	else
		return false;
	return true;
}

 

标签:function,return,JS,length,原型,endWith,false,true
来源: https://blog.csdn.net/WingBin/article/details/89224659