/

HTML / CSS / JavaScript Tutorial

JavaScript String method: endsWith()

[this page | pdf | back links]

The endsWith() method (when applied to a JavaScript string) returns true if the string ends with a specified string, otherwise returns false.

 

It has the following syntax with the following parameters:

 

string.endsWith(searchstring, length)

 

Parameter

Required / Optional

Description

searchstring

Required

String to be searched for

length

Optional

(Default is string.length). Length of string to search

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript String Variables


Desktop view | Switch to Mobile