I had answer very similar to basic code, using a ternary operator, in hindsight I could’ve condensed it down to the basic solution
function confirmEnding(str, target) {
return (str.substr(-target.length) == target) ? true : false;
}
confirmEnding("Bastian", "n");