Last active
January 28, 2018 16:13
-
-
Save dragonza/3a3ad3caa44e7f8b6ba7a6e4c0474e3f to your computer and use it in GitHub Desktop.
Palindrome
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 palindrome(str) { | |
const arr = str.split(''); // turn a string in to an array of characters | |
return arr.every((char, i) => char === str[str.length - 1 - i]); // return true if all elements in the array pass the test implemented by the provided function. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment