endsWith < String < JavaScript
The endsWith() of a String determines whether a string ends with the characters of the string.
const sentence = 'Cats are the best!';
const sentenceEndsWith = sentence.endsWith('best!');
console.log(sentenceEndsWith);
// true
console.log(sentenceEndsWith);
// true