Good, I have a small exercise done in javascript in which determines if a word entered by keyboard is palidrome or not. With words if it works correctly, but when I enter a sentence, it always jumps me with the fact that it is not palindrome.
Code:
function palindromo() {
var texto;
var alReves;
texto = prompt("Introduce texto o palabra: ");
alReves = cambiar(texto);
if (texto == alReves) {
document.write("Palindromo");
} else {
document.write("No palindromo");
}
}
function cambiar(texto) {
return texto.split("").reverse().join("");
}
palindromo();