I think I am on to something,concerning the Confirm the Ending algorithm challenge. But I might be wrong.
It seems that I cant make my target.lenght turn negative. Think that would solve the challenge. Maybe not.
Is there a way to make a parameter value negative in the str.substr() method ? Check out my code please …
function confirmEnding(str, target) {
var a = str.substr(-target.lenght, target.length);
if (a === target) {return true;}
return false;
}
confirmEnding("Rana", "na");