target is a string (of one character) and newArr.length-1 is a number so you can’t compare these two to see if they are equal because they will never be. In the if condition you want to compare the value of the last entry in newArr with the target. There are many ways to get the last value in an array. How would you get the first value in an array?
Not saying this is the wrong approach, but it may be that you’re over-thinking this a little. Have you taken a look at String.substring(…) yet? It may be a more straightforward route to what you’re trying to do.
Consider the logic - you want to compare the last <length of comparator> letters of <string> to <comparator> itself. .substring(...) can help you do just that.
See, you got to remember, you might not only have confirmEnding("Bastien", "n"), you might also get confirmEnding("Congrats", "rats") - and your current approach won’t really allow that.