Confirm the Ending; works but not accepted

I wrote this code that returns the correct answer for all the supplied scenarios, yet won’t give me the challenge complete. Suggestions?

Your code so far

function confirmEnding(str, target) {
  
if(target == str.substr(-(target.length))){
  return "true";
} else {
  return "false";
}
}

confirmEnding("He has to give me a new name", "name")

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/confirm-the-ending

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

markdown_Forums

1 Like

"true" and "false" are not the same things as true and false.

ah got it, thanks you two