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;
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:

Hi & welcome, small typo - you have written If with an uppercase I instead of if.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.