Skip to content

Instantly share code, notes, and snippets.

@AlessioNovi
Created April 9, 2017 23:00
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 AlessioNovi/d0b973f4297bc2fd174df630b0441573 to your computer and use it in GitHub Desktop.
Save AlessioNovi/d0b973f4297bc2fd174df630b0441573 to your computer and use it in GitHub Desktop.
function confirmEnding(str, target) {
var Newtarget = target.substring(-1);
var newString = str.substr(-1); // if i input str.substr(-1 -3); it will pass this test but fails the first one as expected
if (newString == Newtarget) {
return true;
}
return false;
}
confirmEnding("Open sesame", "same");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment