Created
December 20, 2016 22:44
-
-
Save bflannery/1bcefed84e872446a245f92c4c928e97 to your computer and use it in GitHub Desktop.
Confirm The Ending of a String
This file contains 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
// Check if a string (first argument, str) ends with the given target string (second argument, target). | |
function confirmEnding(str, target) { | |
return str.substr(-target.length) === target; | |
} | |
console.log(confirmEnding("Bastian", "n")); | |
console.log(confirmEnding("Walking on water and developing software from a specification are easy if both are frozen", "specification")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment