I am working on Confirm the End challenge. I had almost all the green checks except two and I have been cracking my brain to no avail. Please help me check
function confirmEnding(str, target) {
// “Never give up and good luck will find you.”
// – Falcor
for (i = 0; i < str.length; i++){
var len = str.length - 1;
if (str.substring(len) !== target){
return false;
}
else{ str.substring(0, target);
}
return true;
}
}
confirmEnding(“Bastian”, “n”);