I just learned about this string library:
Include the js file and then use the S
variable like this:
S('hi there').endsWith('hi there')
It can also be used in NodeJS by installing it:
npm install string
Then requiring it as the S
variable:
var S = require('string');
The web page also has links to alternate string libraries, if this one doesn't take your fancy.