Suggestion for solution

Solution 1 can be simplified to:

function confirmEnding(str, target) {
  return str.slice(-target.length) === target

If a negative number is provided as the first parameter to slice(), the offset is taken backwards from the end of the string.

1 Like

Hello there.

Thank you, for your contribution. For future contributions, please wrap your solution within :

code goes here...

Also, provide all of the necessary code to pass the challenge.