Skip to content

Instantly share code, notes, and snippets.

@scilganon
Created July 26, 2019 15:31
Show Gist options
  • Save scilganon/c89a453820e2671d07f255922b7798c3 to your computer and use it in GitHub Desktop.
Save scilganon/c89a453820e2671d07f255922b7798c3 to your computer and use it in GitHub Desktop.
find polyndrome
function isPolyndrom(str){
const head = str.slice(0, Math.floor(str.length / 2));
const tail = Array.from(str.slice(Math.round(-str.length / 2), str.length)).reverse().join("");
console.log(head, tail);
return head === tail;
}
console.log(isPolyndrom("avva"));
console.log(isPolyndrom("ava"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment