Created
June 21, 2016 14:16
-
-
Save brainyfarm/c04572c6ca2729575950eec2dbb3b997 to your computer and use it in GitHub Desktop.
Olawale/FreeCodeCamp Algorithm: 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) { | |
return str.endsWith(target); | |
} | |
/** | |
Alternate solution below | |
function confirmEnding(str, target) { | |
// "Never give up and good luck will find you." | |
// -- Falcor | |
return str.substr(-target.length)==target; | |
} | |
confirmEnding('Bastian', 'n'); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment