-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02_to_hacker_language.js
More file actions
52 lines (50 loc) · 1.11 KB
/
02_to_hacker_language.js
File metadata and controls
52 lines (50 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// /*
// * 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")
// */
//Se declara una colección con el alfabeto y los numeros
const alphabet = {
A:"4",
B:"I3",
C:"[",
D:")",
E:"3",
F:"|=",
G:"&",
H:"#",
I:"1",
J:",_|",
K:">|",
L:"1",
M:"/\\/\\", // Doble barra en \\ para escapar el caracter
N:"^/",
O:"0",
P:"|*",
Q:"(_,)",
R:"I2",
S:"5",
T:"7",
U:"(_)",
V:"\\/",
W:"\\/\\/",
X:"><",
Y:"j",
Z:"2",
1:"L",
2:"R",
3:"E",
4:"A",
5:"S",
6:"b",
7:"T",
8:"B",
9:"g",
0:"o",
}
const word = "Keys4Dev"
const leetWord = word.split('').map(char => alphabet[char.toUpperCase()]).join('');
console.log(leetWord);