Learn JavaScript
String Methods
17.10
Lesson

Matching Initial Characters of String

The startsWith() method checks if a particular string starts with another substring and then returns true or false accordingly.

In the example given above, Sam loves mangoes. starts with the substring S and hencemyString.startsWith("S") returns true.