i have solved the code using the hint from the website and understand why this works. However i don’t understand why my original solution doesn’t work.
This is my code to solve the problem. For some reason the console says i am missing a semi colon after the if statement can anyone help with this?
function confirmEnding(str, target) {
let same = true;
let count = 1;
while (same === true && count !== target.length){
If (str[str.length - count] !== target[target.length - count]){
same = false;
}
count++;
}
return same;
}
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15
Challenge: Confirm the Ending
Link to the challenge: