How do you check if a string starts with another string

Posted by Andre Scott | Updated on

You can use ECMAScript 6’s String.prototype.startsWith() method to check if a string starts with another string or not. But it is not yet supported in all browsers. Let’s see an example to see this usage,


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers