Last active
May 10, 2018 16:35
-
-
Save AdrianSkar/feb5aa7a889e104753d39f40429e791f to your computer and use it in GitHub Desktop.
fCC JS exercise: "Confirm the ending" https://codepen.io/adrianskar/pen/odEZVP
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.substr(-target.length) === target; | |
// With the substring() method: return str.substring(str.length - target.length) === target; | |
// Using the endsWith() method: return str.endsWith(target); | |
} | |
confirmEnding("Bastian", "n"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment