Python-style startswith and endswith string functions in Javascript

The Python language has useful string methods to search for prefixes and suffixes:


my_string.startswith('pre')

The same thing can be achieved in Javascript using the rather powerful search and replace methods.

Continue Reading »