Something wrong with substring

Tell us what’s happening:
i m trying str.substring(i, str.length) === target , i have no idea why its gone heywired

Your code so far

function confirmEnding(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor
  for (var i = 0; i < str.length; i++) {
     if (str.substring(i, str.length) === target){
       return true;
     } else {
       return false;
     }
  }
}
confirmEnding("Bastian", "n");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

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

str.substring(i, str.length) === target should have return me target value comparasions

Your solution only iterates one time through the for loop before it returns a value of true or false is encountered. Remember, as soon as a return statement is encountered, the value specified is returned to the calling function and the function is exited immediately. Even if a for loop has not completed all iterations, the function is exited when return is executed.

ok, that makes sense , thank u , i think this is correct str.substring(i, str.length) === target but i need to finish the iterations and then decide the return