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