Skip to content

Instantly share code, notes, and snippets.

@brainyfarm
Created June 21, 2016 14:16
Show Gist options
  • Save brainyfarm/c04572c6ca2729575950eec2dbb3b997 to your computer and use it in GitHub Desktop.
Save brainyfarm/c04572c6ca2729575950eec2dbb3b997 to your computer and use it in GitHub Desktop.
Olawale/FreeCodeCamp Algorithm: Confirm the Ending
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