Created
April 9, 2017 23:00
-
-
Save AlessioNovi/d0b973f4297bc2fd174df630b0441573 to your computer and use it in GitHub Desktop.
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
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