Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 7, 2019 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/57a34242a25b21aa967d117719e5f33c to your computer and use it in GitHub Desktop.
Save parzibyte/57a34242a25b21aa967d117719e5f33c to your computer and use it in GitHub Desktop.
if (!String.prototype.endsWith) {
String.prototype.endsWith = function(search, this_len) {
if (this_len === undefined || this_len > this.length) {
this_len = this.length;
}
return this.substring(this_len - search.length, this_len) === search;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment