Skip to content

Instantly share code, notes, and snippets.

@C-Rodg
Last active February 28, 2017 05:28
Show Gist options
  • Save C-Rodg/79fb7867e46fa79919e9b3455933ef23 to your computer and use it in GitHub Desktop.
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.
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