Been trying to figure out why this solution doesn’t work for the algorithm confirm the ending.
To me it seems like this should work, but it keeps returning true. str.slice(-lengthOfEnd) is giving me end of the string (to the length of target) and it should be checking if that ending = target but it’s not evaluating is correctly for some reason. Any one have any tips?
function confirmEnding(str, target) {
lengthOfEnd = target.length;
if (str.slice(-lengthOfEnd) === target);{
return true; }
return false;
}
confirmEnding("Connor", "n");