Skip to main content Accessibility Feedback

String.startsWith()

Pushes support back to at least IE6.

/**
 * String.prototype.startsWith() polyfill
 */
if (!String.prototype.startsWith) {
	String.prototype.startsWith = function(search, pos){
		return this.slice(pos || 0, search.length) === search;
	};
}