Skip to content

Instantly share code, notes, and snippets.

@masautt
Last active September 6, 2019 04:42
Show Gist options
  • Save masautt/1c9732ad1ff32327d7b6cc7439d1a9af to your computer and use it in GitHub Desktop.
Save masautt/1c9732ad1ff32327d7b6cc7439d1a9af to your computer and use it in GitHub Desktop.
How to check if string is palindrome in JavaScript?
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