Adding native javascript functions
by Taavi Rammar

Adding new functions to javascript native objects is really easy. For example, try following:
String.prototype.endsWith = function(str){
return (this.match(str+"$")==str)
}

Now you can do something like
alert('Does bible end with "Amen."? ' + bible.endsWith("Amen."))

Hope that helps.

Copyright by techTips