StartsWith function for Javascript

The snippet below will give you the StartWith function for Javascript.

Sample Javascript

String.prototype.startsWith = function(text) {
	return (this.indexOf(text) === 0);
};

Please Share us:
Please rate this snippet

2 thoughts on “StartsWith function for Javascript

Leave a Reply