Last active
September 6, 2019 04:42
-
-
Save masautt/1c9732ad1ff32327d7b6cc7439d1a9af to your computer and use it in GitHub Desktop.
How to check if string is palindrome in JavaScript?
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 checkPalindrome (str) { | |
return str == str.split('').reverse().join(''); | |
} | |
console.log(checkPalindrome("Marek")); // --> false | |
console.log(checkPalindrome("kayak")); // --> true | |
// https://stackoverflow.com/questions/14813369/palindrome-check-in-javascript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment