Skip to content

Instantly share code, notes, and snippets.

@waltzaround
Last active October 1, 2015 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waltzaround/756ceccc475064921904 to your computer and use it in GitHub Desktop.
Save waltzaround/756ceccc475064921904 to your computer and use it in GitHub Desktop.
function end(str, target) { // as we input the first and second arguments into the function...
return target === str.substr(str.length - target.length); // we check if the first string ends with the second string, and return the second argument
return str; // and return the first argument
}
end("Bastian", "n", "");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment