Node.js examples for String:String End
Use if statement to check string ends
if (!String.prototype.endsWith) { String.prototype.endsWith = function(suffix, position) { var str = this; /*from www . j a v a 2 s. c om*/ if (position) { str = str.substring(position); } if (str.length < suffix.length) { return false; } return str.slice(0 - suffix.length) == suffix; }; }