Javascript : endsWith()

Returns true or false depending on if a string finishes with characters from another string.

string.endsWith(searchString, length)

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:

let str = "Hello, World!";
console.log(str.endsWith("World!")); // Output: true
console.log(str.endsWith("Hello")); // Output: false