GitHub 6248★

Check if a string is a palindrome

JavaScript version

const isPalindrome = (str) => str === str.split('').reverse().join('');

TypeScript version

const isPalindrome = (str: string): boolean => str === str.split('').reverse().join('');

Examples

isPalindrome('abc'); // false
isPalindrom('abcba'); // true
Follow me on and to get more useful contents.