forked from mouredev/retos-programacion-2023
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
341d4f9
commit 9c65242
Showing
1 changed file
with
18 additions
and
3 deletions.
There are no files selected for viewing
21 changes: 18 additions & 3 deletions
21
Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/javascript/moragacomar.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
const mensaje = "Hola" | ||
/* # Reto #1: EL "LENGUAJE HACKER" | ||
* #### Dificultad: Fácil | Publicación: 02/01/23 | Corrección: 09/01/23 | ||
* | ||
* Escribe un programa que reciba un texto y transforme lenguaje natural a | ||
* "lenguaje hacker" (conocido realmente como "leet" o "1337"). Este lenguaje | ||
* se caracteriza por sustituir caracteres alfanuméricos. | ||
* - Utiliza esta tabla (https://www.gamehouse.com/blog/leet-speak-cheat-sheet/) | ||
* con el alfabeto y los números en "leet". | ||
* (Usa la primera opción de cada transformación. Por ejemplo "4" para la "a") | ||
*/ | ||
|
||
|
||
|
||
const lenguaje = { | ||
"a": "4", "b": "I3", "c": "[", "d": ")", "e": "3", "f": "|=", "g": "&", "h": "#", "i": "1", | ||
"j": ",_|", "k": ">|", "l": "1", "m": "/\/\\", "n": "^/", "o": "0", "p": "|*", "q": "(_,)", | ||
"r": "I2", "s": "5", "t": "7", "u": "(_)", "v": "\/", "w": "\/\/", "x": "><", "y": "j", | ||
"z": "2" | ||
} | ||
const hacker = mensaje.toLowerCase().split("").map(e => lenguaje[e]) | ||
|
||
console.log(hacker.join("")) | ||
const sustituir = (mensaje) => { | ||
return mensaje.toLowerCase().split("").map(e => lenguaje[e]).join("") | ||
} | ||
|
||
console.log(sustituir("HOLA, Juan Manuel")) |