Confirm the Ending full answer to get all the strings

Tell us what’s happening:

it doesnt get all the answers correct only few!

Your code so far

function confirmEnding(str, target) {
     if(str.substring(str.length - 1) === target){
     return true;
   } else{
     return false;

confirmEnding("Bastian", "n");

Your browser information:

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

Link to the challenge:

Good try!

Notice you are only passing tests when target has length of 1. Can you dynamically take substring of str instead of single letter, like target’s length?