My code will not return the false

function confirmEnding(str, target) {
  for (let i = 0; i < str.length; i++) {
    if (str.Max === target[i]) {
     } return true;
  } 
    return false;
}
confirmEnding("Bastian", "n");

You have provided very little information for us to be able to help.

What are you trying to do?

How does this code not work?

If this is a freeCodeCamp challenge, what is the link to the challenge?


Here is your code with proper indentation:

function confirmEnding(str, target) {
  for (let i = 0; i < str.length; i++) {
    if (str.Max === target[i]) {}
    return true;
  }
  return false;
}
confirmEnding("Bastian", "n");
1 Like

I have edited your post to include the challenge link so we know what you are working on.