category | contributors | created | title | updated | |
---|---|---|---|---|---|
String |
|
2020-05-18 |
Check if a string is a palindrome |
2021-10-13 |
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