Check if a string (first argument, str) ends with the given target string (second argument, target).
This challenge can be solved with the .endsWith() method, which was introduced in ES2015. But for the purpose of this challenge, we would like you to use one of the JavaScript substring methods instead.
Here are some helpful links:
function confirmEnding(str, target) {
if ( str.substring(str.length - target.length) == target) {
console.log('RETURN => TRUE : ', str.substring(str.length - target.length));
overlay(true);
return true;
} else {
console.log('RETURN => FALSE : ', str.substring(str.length - target.length));
overlay(false);
return false;
}
}