Created
October 15, 2015 15:27
-
-
Save platypusrex/8a90c6dfbada4cfe161e to your computer and use it in GitHub Desktop.
Javascript - Check if a string (first argument) ends with the given target string (second argument).
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 end(str, target) { | |
return str.substr(str.length - target.length) === target ? true : false; | |
} | |
end('platypus', 's'); | |
end('I\'m pretty sure this thing is on', 'on'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment