Node.js examples for String:String End
Using slice method to check string end
if (typeof String.prototype.endsWith != 'function') { String.prototype.endsWith = function(str) { return this.slice(-str.length) == str; };//from w ww . j a va 2s . c om }