Hey! I can’t seem to figure out why the Bastian example won’t return true. Any help would be super appreciated. Thanks!
function confirmEnding(str, target) {
if(target.length === 1) {
if(target === str.charAt(str.length)) { return true; }
else if(target !== str.charAt(str.length)) {return false;}
}
else if(target.length > 1) {
if(target.charAt(target.length) === str.charAt(str.length) && target.charAt((target.length) -2 ) === str.charAt((str.length) -2)) {
return true; }
else return false; }}
confirmEnding("Bastian", "n");