Javascript : endsWith()

Returns true or false depending on if a string finishes with characters from another string. searchString: The characters to be searched for at the end of the string.length (optional): The length of the string to be considered. Default is the length of the string. Here is an example of the function: