endsWith() method determines whether a string ends with a specified string.
syntax ↴
endsWith(searchString, endPosition) ↴
searchString The characters to be searched for at the end of specified string.
Cannot be a regex. All values that are not regexes are coerced to strings.
endPosition (optional). The end position at which searchString is expected to be found (the index of searchString's last character plus 1).
endsWith() method returns true if a string ends with a specified string.
endsWith() method returns false if a string does NOT end with a specified string.
endsWith() method throws TypeError if searchString is a regex.
endsWith() method is case sensitive.
You can use an end position where the searchString is expected to be found inside a string.
endPosition: optional argument specifies the position up to which the string will be tested. The default value is the length of the string.
myString.endsWith(searchString)
myString.endsWith(searchString, endPosition)