I’m not quite sure why my program isn’t working.
Here is the code:
function confirmEnding(str, target) {
for(var x = str.length-1; x < str.length; x++){
for(var j = target.length-1; j>=0; j--){
if(str[x] === target[j]){
return true;
} else{
return false;
}
}
}
}
confirmEnding("Connor", "n");
Everything works except that 1 line of
"confirmEnding(“Walking on water and developing software from a specification are easy if both are frozen”, “specification”)"
That one doesn’t return false, so I can’t pass the challenge.
I do not want to write the program the regular way of
return str.substring(-target.length) === true;
If anyone can provide a solution to the code i provided, it’ll be much appreciated !