Tell us what’s happening:
My code passes the tests so i’m not entirely sure if this is where I should put my question.
After I finish the challenges, I usually go to the challenge guide to check the solutions and see if there is a simpler way to write my code.
But when I checked the solutions, it seems none are quite the same my code.
Is the fact my code passes a bug?
Your code so far
function confirmEnding(str, target) {
for(let i = target.length; i > 0; i--){
if(target[target.length - i] != str[str.length - i]){
return false;
}
}
return true;
}
confirmEnding('Bastian', 'n');
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Mobile Safari/537.36
Challenge Information:
Basic Algorithm Scripting - Confirm the Ending