function confirmEnding(str, target) {
// "Never give up and good luck will find you."
// -- Falcor
var diff = str.length - target.length;
if(str.substring(diff,str.length) === target){
return true;
} else {
return false;
}
}
confirmEnding("Bastian", "n");
No comments:
Post a Comment