How can I check if a string ends with a particular character in JavaScript?
Example: I have a string
var str = \"mystring#\";
I wa
This is the implementation of endsWith:
endsWith
String.prototype.endsWith = function (str) { return (this.length >= str.length) && (this.substr(this.length - str.length) === str); }