Node.js examples for String:String End
Check String ends with using lastIndexOf method
String.prototype.endsWith = function(pattern) { var d = this.length - pattern.length; return d >= 0 && this.lastIndexOf(pattern) === d; };