function endsWith( targetStr, str ) { return targetStr.substr( -1 * str.length, str.length ) === str; }or
if ( typeof String.prototype.endsWith != 'function' ) {
String.prototype.endsWith = function( str ) {
return this.substr( -1 * str.length, str.length ) === str;
}
};
No comments:
Post a Comment