Skip to content

Commit 9169af9

Browse files
committed
#4 - TypeScript
1 parent 36aacf5 commit 9169af9

File tree

1 file changed

+23
-4
lines changed
  • Roadmap/04 - CADENAS DE CARACTERES/typescript

1 file changed

+23
-4
lines changed

Roadmap/04 - CADENAS DE CARACTERES/typescript/RicJDev.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,39 @@ fruits.forEach((fruit) => {
6060

6161
//Reemplazo
6262
let musicPlayer = 'Music Player current song: The Pretender - Foo Fighters'
63+
console.log(musicPlayer)
6364

65+
musicPlayer = musicPlayer.replace('The Pretender - Foo Fighters', 'Monster - Skillet')
6466
console.log(musicPlayer)
65-
console.log(musicPlayer.replace('The Pretender - Foo Fighters', 'Monster - Skillet'))
6667

6768
//División
69+
const companiesString: string = 'Google, Apple, Telegram, Facebook'
70+
const companiesArr = companiesString.split(', ')
71+
72+
console.log(companiesArr)
6873

6974
//Unión
75+
const colorsArray = ['blue', 'red', 'yellow', 'white']
76+
const colorsString = colorsArray.join(', ')
77+
78+
console.log(colorsString)
7079

7180
//Interpolación
72-
console.log(`\n\"TypeScript es JavaScript premium\" \n\n\t\t\t${ric.toUpperCase()}`)
81+
console.log(`\n\"TypeScript es JavaScript premium\" \n\n\t\t\t${ric.toUpperCase()}\n`)
7382

7483
//Verificación
84+
const fiveInSpanish: string = 'Cinco'
85+
const fiveCharsRegex = /\b[A-Za-z]{5}\b/g
86+
87+
console.log('Tiene cinco caracteres la palabra "cinco"?', fiveCharsRegex.test(fiveInSpanish))
7588

7689
//Otros
90+
const randomPhrase = 'Pedro estaba bebiendo un jugo de manzana'
91+
const jRegex = /\b[Jj]{1}[A-Za-z]{3}\b/g
92+
93+
let result = randomPhrase.match(jRegex)
94+
95+
console.log(result)
7796

7897
//EXTRA
7998
function analyzeTheseWords(word1: string, word2: string) {
@@ -118,5 +137,5 @@ function analyzeTheseWords(word1: string, word2: string) {
118137
isogram(word2)
119138
}
120139

121-
// analyzeTheseWords('Roma', 'Amor')
122-
// analyzeTheseWords('Radar', 'Paloma')
140+
analyzeTheseWords('Roma', 'Amor')
141+
analyzeTheseWords('Radar', 'Paloma')

0 commit comments

Comments
 (0)