Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Orliluq authored Jan 24, 2024
1 parent 25d2478 commit c28f078
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,29 @@ function showTextarea(textareaValue) {
}

//Función que verifica si el texto posee acentos y en caso de que sí, las reemplaza por caracteres sin acento.
function checkText(textareaValue) {
/* function checkText(textareaValue) {
let newText = textareaValue.replace(/á/g, "a")
.replace(/é/g, "e")
.replace(/í/g, "i")
.replace(/ó/g, "o")
.replace(/ú/g, "u")
.replace(/Á/g, "")
.replace(/É/g, "")
.replace(/Í/g, "")
.replace(/Ó/g, "")
.replace(/Ú/g, "")
return newText;
} */

function checkText(textareaValue) {
// Convierte todo el texto a minúsculas
let lowerCaseText = textareaValue.toLowerCase();
// Realiza el reemplazo de los caracteres acentuados por caracteres no acentuados
let newText = lowerCaseText.replace(/á/g, "a")
.replace(/é/g, "e")
.replace(/í/g, "i")
.replace(/ó/g, "o")
.replace(/ú/g, "u");
return newText;
}

Expand Down Expand Up @@ -130,4 +147,4 @@ btnDecrypt.addEventListener("click", () => {

btnCopy.addEventListener("click", function() {
copyText(encryptedTextarea.value);
});
});

0 comments on commit c28f078

Please sign in to comment.