Confirm the Ending- help me pls

Tell us what’s happening:

Your code so far


function confirmEnding(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor
  var a = str.substring((str.lengt-1)-target.length);
  if (a == target){
    return true;
  } else {
    return false;
  }
}

confirmEnding("Bastian", "n");

Link to the challenge:

You made a typo: str.lengt

1 Like

i updated the code
where is problem now?

Check the value of a.

1 Like

You still have a typo on the following line:

var a = str.substring((str.lengt-1)-target.length);
1 Like

ty guys
Love freeCodeCamp and u especially <3