Skip to content

Commit

Permalink
Merge pull request mouredev#5711 from almarro1/reto30
Browse files Browse the repository at this point in the history
reto#30 - javascript
  • Loading branch information
Roswell468 authored Nov 13, 2023
2 parents 7ef7cd2 + 1a3f06f commit 30ccb22
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Retos/Reto #30 - EL TECLADO T9 [Media]/javascript/almarro1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const translations = {
'2': 'A',
'22': 'B',
'222': 'C',
'3': 'D',
'33': 'E',
'333': 'F',
'4': 'G',
'44': 'H',
'444': 'I',
'5': 'J',
'55': 'K',
'555': 'L',
'6': 'M',
'66': 'N',
'666': 'O',
'7': 'P',
'77': 'Q',
'777': 'R',
'7777': 'S',
'8': 'T',
'88': 'U',
'888': 'V',
'9': 'W',
'99': 'X',
'999': 'Y',
'9999': 'Z',
};

function translate(sequence) {
return sequence.split('-').map(x => translations[x]).join('');
}

console.log(`6-666-88-777-33-3-33-888 -> ${translate('6-666-88-777-33-3-33-888')}`)

0 comments on commit 30ccb22

Please sign in to comment.