Is there any instance where this doesn’t work/ is this bad practice?
function confirmEnding(str, target) {
str=str.split(target);
console.log(str);
if(str[str.length-1]!=‘’){
return false
}
return true;
}
confirmEnding(“Bastian”, “n”);
function confirmEnding(str, target) {
str=str.split(target);
console.log(str);
if(str[str.length-1]!=''){
return false
}
return true;
}
confirmEnding("Bastian", "n");
Challenge: Basic Algorithm Scripting - Confirm the Ending
Link to the challenge: