Learn JavaScript
String Methods
17.22
Lesson

Matching End Characters of String

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

In the example given above, Sam loves mangoes. ends with the substring s and hence myString.startsWith("S") returns true.