Confirm the Ending : Logic is failing for one test case

Tell us what’s happening:
All the test cases except one, doesn’t seems to like my code. Can anyone of you please let me know why?
FCC is asking when the input is like this,
confirmEnding(“Walking on water and developing software from a specification are easy if both are frozen”, “specification”) should return false.

Your code so far

function confirmEnding(str, target) {
    // console.log(str);
    var strEnd = str.substr(-1);
    var tarEnd = target.substr(-1);
    if(strEnd === tarEnd){
        return true;
    }
    else{
        return false;
    }

}

confirmEnding("Bastian", "n");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) 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

Your code is only comparing the last letters of str and target (as opposed to comparing the whole target against the end of str).

Cool…thanks @kevcomedia
adding this
var strEnd = str.substr(-target.length)

worked just fine!