From bc936a19a95326d75ad7c69f4d25d6604f3cd032 Mon Sep 17 00:00:00 2001 From: lmaccaro-maker Date: Fri, 28 Mar 2025 18:05:02 +0100 Subject: [PATCH 1/4] updated --- .DS_Store | Bin 0 -> 6148 bytes js/index.js | 1 + 2 files changed, 1 insertion(+) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..7cc64b92722fb4bcdb1a1f8a15a967d6d8f305a6 GIT binary patch literal 6148 zcmeHKJ#P~+7`D?ueX5W$fK-Xa5^K~Z1R)U15v~IROAox!FJW{%@pL$yRsG>)k6O=-$&*!mn7qhF^Fiz86H`uySvi_;LY9sY z^6F()re@wZvoftXH?|HHs9@0ATr9f1UR(DbbeCg_5JwE?f2il(znbxg-I{LG+5{3?Ii@bH9;41*I2{Q}o{O<$QWB`T^Ym2Zzq)i3dROzl5(x$_% zU0mp}wrJCZ< literal 0 HcmV?d00001 diff --git a/js/index.js b/js/index.js index 59e4af7..f997e99 100644 --- a/js/index.js +++ b/js/index.js @@ -4,3 +4,4 @@ // Iteration 3: Loops +console.log("¡Estoy listo!"); \ No newline at end of file From 46c7644cd119472eeee081eec9fd9e01f1a67b49 Mon Sep 17 00:00:00 2001 From: lmaccaro-maker Date: Fri, 28 Mar 2025 19:05:12 +0100 Subject: [PATCH 2/4] updated --- .DS_Store | Bin 6148 -> 6148 bytes js/index.js | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/.DS_Store b/.DS_Store index 7cc64b92722fb4bcdb1a1f8a15a967d6d8f305a6..924c27f855f497cc08dfab35c0961acbf2134f98 100644 GIT binary patch delta 342 zcmZoMXfc=|#>B!ku~2NHo}!=t0|Nsi1A_oVPP$=ma(-^X=8ep&nd?EqEDU-K=?s|+ zB`_(V7!d662NH0(+w=aFqASRp<2&29ijwT1+pVJ?(LIqgE#_c5UMJKQ*f&SJBS+?5Fn>8Feor==3)BG hw3(fQp92_bz|i^5Jegm_kpmcLOdtiDBSh9P0{~O5PQ3sC delta 83 zcmZoMXfc=|#>B)qF;Q%yo}wrR0|Nsi1A_oVQcivnkSzejjvEt~Gcs~)7GeF&w6TDL gc{4i)KL=3DWz hacker2.length) { + console.log(`El conductor tiene el nombre más largo, tiene ${hacker1.length} caracteres.`); +} else if (hacker1.length < hacker2.length) { + console.log(`Parece que el navegante tiene el nombre más largo, tiene ${hacker2.length} caracteres.`); +} else { + console.log(`¡Vaya, ambos tienen nombres igual de largos, ${hacker1.length} caracteres!`); +} + + +// Iteración 3: Loops + + +let hacker1 = "Juan"; // Driver's name + +// Convert each character to uppercase and separate by spaces +let spacedName = hacker1.toUpperCase().split('').join(' '); +console.log(spacedName); // Outputs: "J U A N" + + +let hacker2 = "Ana"; // Navigator's name + +// Reverse the order of characters +let reversedName = hacker2.split('').reverse().join(''); +console.log(reversedName); // Outputs: "anA" + + +if (hacker1.localeCompare(hacker2) < 0) { + console.log("The driver's name goes first."); + } else if (hacker1.localeCompare(hacker2) > 0) { + console.log("Yo, the navigator's name goes first definitely."); + } else { + console.log("What? You both have the same name?"); + } \ No newline at end of file From 098947938c6051d9046806b8bb56ee58ae288d0a Mon Sep 17 00:00:00 2001 From: lmaccaro-maker Date: Fri, 28 Mar 2025 19:22:24 +0100 Subject: [PATCH 3/4] updated --- js/index.js | 56 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/js/index.js b/js/index.js index 4b0c2a4..e1c4059 100644 --- a/js/index.js +++ b/js/index.js @@ -1,12 +1,8 @@ -// Iteration 1: Names and Input -// -// Iteration 2: Conditionals -// Iteration 3: Loops console.log("¡Estoy listo!"); -// Iteración 1: Nombres y entradas + let hacker1 = "Juan"; @@ -16,7 +12,7 @@ let hacker2 = "Ana"; console.log("El nombre del conductor es " + hacker2); -// Iteración 1: Nombres y entradas +// Iteración 1: Name and Inputs if (hacker1.length > hacker2.length) { console.log(`El conductor tiene el nombre más largo, tiene ${hacker1.length} caracteres.`); @@ -26,10 +22,8 @@ if (hacker1.length > hacker2.length) { console.log(`¡Vaya, ambos tienen nombres igual de largos, ${hacker1.length} caracteres!`); } - // Iteración 3: Loops - let hacker1 = "Juan"; // Driver's name // Convert each character to uppercase and separate by spaces @@ -40,6 +34,7 @@ console.log(spacedName); // Outputs: "J U A N" let hacker2 = "Ana"; // Navigator's name // Reverse the order of characters + let reversedName = hacker2.split('').reverse().join(''); console.log(reversedName); // Outputs: "anA" @@ -50,4 +45,47 @@ if (hacker1.localeCompare(hacker2) < 0) { console.log("Yo, the navigator's name goes first definitely."); } else { console.log("What? You both have the same name?"); - } \ No newline at end of file + } + + + //bonificacion + + // 1. Guardar texto y generarlo como variable + + let loremIpsumText = `Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. +`; + +// 2. Contar el Número de Palabras en la Cadena. + +let wordCount = loremIpsumText.split(/\s+/).filter(Boolean).length; +console.log(`The number of words is: ${wordCount}`);v + +// 3. Contar la Aparición de la Palabra "et". + + +let etCount = (loremIpsumText.match(/\bet\b/g) || []).length; +console.log(`The word "et" appears ${etCount} times.`); + +// bono 2 + + +let phraseToCheck = "Un hombre, un plan, un canal, ¡Panamá!"; // Frase original + +// Preproceso: Normalizamos la cadena +let cleanedPhrase = ''; +for (let char of phraseToCheck) { + if (char.match(/[a-z0-9]/i)) { // Filtra caracteres no alfanuméricos + cleanedPhrase += char.toLowerCase(); // Convierte a minúscula para comparar + } +} + +// Comprobación de palíndromo usando un bucle en la cadena limpiada +let isPalindrome = true; +for (let i = 0; i < cleanedPhrase.length / 2; i++) { + if (cleanedPhrase[i] !== cleanedPhrase[cleanedPhrase.length - 1 - i]) { + isPalindrome = false; + break; + } +} + +console.log(`La frase "${phraseToCheck}" es ` + (isPalindrome ? "un palíndromo." : "no es un palíndromo.")); \ No newline at end of file From 45c17eea093e7d8ff392ccafa50146db741b400d Mon Sep 17 00:00:00 2001 From: lmaccaro-maker Date: Sat, 29 Mar 2025 10:34:16 +0100 Subject: [PATCH 4/4] updated --- .DS_Store | Bin 6148 -> 6148 bytes index.html | 13 +++++++++++++ js/index.js | 13 ++++--------- 3 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 index.html diff --git a/.DS_Store b/.DS_Store index 924c27f855f497cc08dfab35c0961acbf2134f98..9d77aee7688931024defe4cab723ccb3abb6319a 100644 GIT binary patch delta 21 ccmZoMXffEJ#=`U>e6j{h6yt-<%`A<=08rrvOaK4? delta 21 ccmZoMXffEJ#=^A2f3gNk6yt);%`A<=08Ehv)Bpeg diff --git a/index.html b/index.html new file mode 100644 index 0000000..b7c9fc4 --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + + + + + Document + + + + + + + \ No newline at end of file diff --git a/js/index.js b/js/index.js index e1c4059..729bee5 100644 --- a/js/index.js +++ b/js/index.js @@ -3,8 +3,6 @@ console.log("¡Estoy listo!"); - - let hacker1 = "Juan"; console.log("El nombre del conductor es " + hacker1); @@ -24,15 +22,11 @@ if (hacker1.length > hacker2.length) { // Iteración 3: Loops -let hacker1 = "Juan"; // Driver's name // Convert each character to uppercase and separate by spaces let spacedName = hacker1.toUpperCase().split('').join(' '); console.log(spacedName); // Outputs: "J U A N" - -let hacker2 = "Ana"; // Navigator's name - // Reverse the order of characters let reversedName = hacker2.split('').reverse().join(''); @@ -48,7 +42,8 @@ if (hacker1.localeCompare(hacker2) < 0) { } - //bonificacion + //bonificacion- + //Bono 1 // 1. Guardar texto y generarlo como variable @@ -58,10 +53,10 @@ if (hacker1.localeCompare(hacker2) < 0) { // 2. Contar el Número de Palabras en la Cadena. let wordCount = loremIpsumText.split(/\s+/).filter(Boolean).length; -console.log(`The number of words is: ${wordCount}`);v -// 3. Contar la Aparición de la Palabra "et". +console.log(`The number of words is: ${wordCount}`); +// 3. Contar la Aparición de la Palabra "et". let etCount = (loremIpsumText.match(/\bet\b/g) || []).length; console.log(`The word "et" appears ${etCount} times.`);