Created
January 17, 2017 12:03
-
-
Save mijimoco/490202af1c15e5a90be0968fb057371b to your computer and use it in GitHub Desktop.
Confirm the Ending
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function confirmEnding(str, target) { | |
// "Never give up and good luck will find you." | |
// -- Falcor | |
var ending = str.substr(-target.length); | |
if (ending === target) { | |
return true; | |
} else { | |
return false; | |
} | |
} | |
confirmEnding("Bastian is", "is"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment