Endingwith() method

Why is this returning false? It should return true…

function confirmEnding(str, target) {
  return str.endsWith("target");

console.log(confirmEnding("Bastian", "n"));

If I recall the challenge correctly, you are not supposed to use the endsWith method.

In any case, "target" is not target.

It would help if you provide a link to the challenge you are working on.

1 Like

Correct you’re not suppose to use the Method. It was for the sake of understanding the method. It works now, thanks Jeremy!

1 Like

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