Please help me find out what went wrong

Tell us what’s happening:
Hello everyone here.
Could anyone possibly tell me what went wrong here? Why can’t I use “else” to return false?
Many thanks!

Your code so far

function confirmEnding(str, target) {
   if (target === str.substr(-target.length));{
     return true;
   }
else 
  return false;
   }
confirmEnding("Bastian", "n");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/confirm-the-ending

You have a semicolon after your if condition.

1 Like

Thank you so much. I should have scooped my useless eyes out.

1 Like