String.prototype.endswitch = function(str) {
if (str === null || str === '' || this.length === 0 || str.length > this.length) {
return false;
}
if (this.substring(this.length - str.length) === str) {
return true;
} else {
return false;
}
return true;
}
console.log("abc".endswitch("bc"));