// No se puede entender lo que está mal en este código que siempre muestra que la cadena no es // palíndromo
**Check this** <script> var isPalindrome = function (str) { const st = str.split("").reverse().join(); console.log(st); if (str == st) { console.log("It is a palindrome"); } else { console.log("It is not a palindrome"); } }; let str = "abba"; isPalindrome(str); </script> //I have tried a lot. unable to understand why stack overflow is taking to much time to upload only showing err // const isPalindrome = (str) => { const str2 = str.split("").reverse().join(""); if (str == str2) { console.log("It is a palindrome"); } else { console.log("It is not a palindrome"); } }; isPalindrome('aabb'); isPalindrome('abba');Puedes probar esto,
function palindrome(str) { let reversed = str.split('').reduce((acc, cur) => cur + acc, ''); if (str === reversed) { return true; } else { return false; } } let str = "abba"; console.log(palindrome(str));