String.prototype.endsWithbeginnerconst str = 'Hello, World!'
str.endsWith('!') // β true
str.endsWith('World') // β false
str.endsWith('World', 12) // β trueUse endsWith() to check if a string ends with a specific suffix, with an optional end position.
str.endsWith(searchString) returns true if the string ends with the given suffix.
Challenge: Implement endsWithPeriod(str) that returns true when str ends with '.'.
endsWithPeriod('Hello.') // β true
endsWithPeriod('Hello!') // β false