Is there a simple way to make this function/method work with strings that end with a question mark?
String.prototype.EndsWith = function(str){return (this.match(str+"$")==str)}
var aa='a cat';
var bb='a cat?';
if( aa.EndsWith('cat') ){
document.write('cat matched'+'<br\/>');
}
if( bb.EndsWith('cat?') ){
document.write('cat? matched');
}
In the current state, only the first test is matched (cat).