Last active
February 28, 2017 05:28
-
-
Save C-Rodg/79fb7867e46fa79919e9b3455933ef23 to your computer and use it in GitHub Desktop.
A simple function to determine if one string is a round rotation of another.
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 roundStrings(s1, s2) { | |
for (let i in s1) { | |
if (s1.hasOwnProperty(i)) { | |
if (s1[i] !== s2[s2.length - i - 1]) { | |
return -1; | |
} | |
} | |
} | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment