Created
July 26, 2019 15:31
-
-
Save scilganon/c89a453820e2671d07f255922b7798c3 to your computer and use it in GitHub Desktop.
find polyndrome
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 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