Skip to content

Commit

Permalink
Merge pull request #6603 from MaryferCepeda/main
Browse files Browse the repository at this point in the history
Reto #1 - javascript
  • Loading branch information
kontroldev authored Jun 25, 2024
2 parents a92d496 + 0223b8e commit 5480dad
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"use strict";
const abecedarioHacker=["4","8","¢","[)","3","ph","6","#","1","]","|{","£","nn","nh","0", "|*","9","Я","5","7","µ","v","Ш","ecks","Ч","2"," "];
const abecedario=["a","b","c","d","e","f","g","h","i","j","k","l","n","ñ","o","p","q","r","s","t","u","v","w","x","y","z"," "];
let palabra=prompt("Dame una palabra"); //Hola
let palabraFinal="";
let letra1="";

function separar(){ //separa palabras por letras
for (let key of palabra){
//document.write(`La letra es ${key} <br>`);
recorrer1(key);

}

}
function comparar(letra,corredor,corredor2){//compara la letra separada con el abecedario normal
if(letra==corredor){
//document.write(`Cuando entra en comparar: ${letra} <br>`);
letra1=letra.replace(letra,corredor2);
palabraFinal+=letra1;
//document.write(`Despues del cambio: ${palabraFinal} <br>`)
}
}
function recorrer1(letra){//recorre el array de abecedario, casilla por casilla voto pot voto
for(let i=0; i<=abecedario.length;i++){

comparar(letra,abecedario[i],abecedarioHacker[i])

}
}
/*function recorrer2(){ //recorre el array de abecedarioHacker, casilla por casilla
for(let key of abecedarioHacker){
}
}
*/
separar();
document.write(palabraFinal);

//////

0 comments on commit 5480dad

Please sign in to comment.