Thank you @nhcarrigan.
I am trying to redeem myself, haha. So this was my answer to the challenge:
function confirmEnding(str, target) {
let lowerCaseStr = str.toLowerCase();
let lowerCaseTarget = target.toLowerCase();
if(lowerCaseStr.substring(lowerCaseStr.length - lowerCaseTarget.length) === lowerCaseTarget){
return true;
} else {
return false;
}
}
console.log(confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "are"));
However, I tried to research another way besides .endsWith() that I could use, and saw that I could use slice and get the same answer:
function confirmEnding(str, target) {
let lowerCaseStr = str.toLowerCase();
let lowerCaseTarget = target.toLowerCase();
if(lowerCaseStr.slice(lowerCaseStr.length - lowerCaseTarget.length) === lowerCaseTarget){
return true;
} else {
return false;
}
}
console.log(confirmEnding('hot cross buns','buns'));
I realize that slice is slightly different than substring, however, in this case it still works! Hopefully that is enough of a redemption lol. Thanks again!