Skip to content

Instantly share code, notes, and snippets.

@AdrianSkar
Last active May 10, 2018 16:35
Show Gist options
  • Save AdrianSkar/feb5aa7a889e104753d39f40429e791f to your computer and use it in GitHub Desktop.
Save AdrianSkar/feb5aa7a889e104753d39f40429e791f to your computer and use it in GitHub Desktop.
fCC JS exercise: "Confirm the ending" https://codepen.io/adrianskar/pen/odEZVP
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