Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions practicas/promesaspokemonoffline/PromesasPokemonLilian.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
const obtenerPokemonPromesas = (nombrePokemon) => {
return new Promise((resolve, reject) => {
// Simular una solicitud asincrona para obtener datos del pokemón
const pokemonDatabase = {
"pikachu": {
"nombre": "Pikachu",
"tipo": "Electrico",
"habilidad": "Electricidad"
},
"bulbasaur": {
"nombre": "Bulbasaur",
"tipo": "Planta",
"habilidad": "Latigo Cepa"
},
"charmander": {
"nombre": "Charmander",
"tipo": "Fuego",
"habilidad": "Lanza Llamas"
},

"mew":{
"nombre": "Mew",
"tipo": "Psíquico",
"habilidad": "Teletransporte"
},

"lucario":{
"nombre": "Lucario",
"tipo": "Lucha",
"habilidad": "Fuerza de la Llama"
},

}

// Comprobar si el pokemon recibido existe en la base de datos.
const pokemonEncontrado = pokemonDatabase[nombrePokemon.toLowerCase()];

if (pokemonEncontrado) {
resolve(pokemonEncontrado);
} else {
reject('No se encontro el pokemon con nombre ' + nombrePokemon);
}
});

};

obtenerPokemonPromesas('mew')
.then((pokemon) => {
console.log('Si lo encontre');
})
.catch((error) => {
console.log('error ', error);
})
.finally(() => {
console.log('Se cierra la busqueda');
});

obtenerPokemonPromesas('lucario')
.then((pokemon) => {
console.log('Si lo encontre');
})
.catch((error) => {
console.log('error ', error);
})
.finally(() => {
console.log('Se cierra la busqueda');
});
127 changes: 127 additions & 0 deletions practicas/rfc/rfcLilian/rfc-LilianGarcia.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<!DOCTYPE html>
<html lang="es">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Generador de RFC</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f4f4f9;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}

h2 {
color: #333;
font-size: 24px;
text-align: center;
}

form {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 400px;
}

label {
display: block;
font-weight: bold;
margin-bottom: 5px;
color: #555;
}

input[type="text"] {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
margin-bottom: 15px;
font-size: 14px;
}

button {
background-color: #007bff;
color: white;
border: none;
padding: 10px 15px;
border-radius: 4px;
font-size: 16px;
cursor: pointer;
width: 100%;
}

button:hover {
background-color: #0056b3;
}

h3 {
font-size: 20px;
color: #333;
margin-top: 20px;
text-align: center;
}

p#resultadoRFC {
background-color: #e0f7fa;
padding: 10px;
border-radius: 4px;
color: #00796b;
text-align: center;
font-size: 18px;
font-weight: bold;
}

@media (max-width: 480px) {
form {
padding: 15px;
width: 90%;
}

button {
font-size: 14px;
}
}
</style>
</head>

<body>
<h2>Generador de RFC</h2>
<form id="rfcForm">
<label for="nombre">Nombre(s):</label>
<input type="text" id="nombre" required>

<label for="apellidoPaterno">Apellido Paterno:</label>
<input type="text" id="apellidoPaterno" required>

<label for="apellidoMaterno">Apellido Materno:</label>
<input type="text" id="apellidoMaterno" required>

<label for="diaNacimiento">Día de Nacimiento (2 dígitos):</label>
<input type="text" id="diaNacimiento" maxlength="2" required>

<label for="mesNacimiento">Mes de Nacimiento (2 dígitos):</label>
<input type="text" id="mesNacimiento" maxlength="2" required>

<label for="anoNacimiento">Año de Nacimiento (últimos 2 dígitos):</label>
<input type="text" id="anoNacimiento" maxlength="2" required>

<button type="button" onclick="generarRFC()">Generar RFC</button>
</form>

<h3>RFC Generado:</h3>
<p id="resultadoRFC"></p>

<script src="rfcLilianGarcia.js"></script>
</body>

</html>
30 changes: 30 additions & 0 deletions practicas/rfc/rfcLilian/rfcLilianGarcia.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
function generarRFC() {
// Obtener valores del formulario
const nombre = document.getElementById("nombre").value.trim().toUpperCase();
const apellidoPaterno = document.getElementById("apellidoPaterno").value.trim().toUpperCase();
const apellidoMaterno = document.getElementById("apellidoMaterno").value.trim().toUpperCase();
const diaNacimiento = document.getElementById("diaNacimiento").value.padStart(2, '0');
const mesNacimiento = document.getElementById("mesNacimiento").value.padStart(2, '0');
const anoNacimiento = document.getElementById("anoNacimiento").value.padStart(2, '0');

// Validación de vocal en el apellido paterno
const vocales = ['A', 'E', 'I', 'O', 'U'];
let segundaLetra = '';
for (let letra of apellidoPaterno.slice(1)) {
if (vocales.includes(letra)) {
segundaLetra = letra;
break;
}
}
if (!segundaLetra) {
alert("El apellido paterno debe contener al menos una vocal después de la primera letra.");
return;
}

// Construir las partes del RFC
const rfc = `${apellidoPaterno[0]}${segundaLetra}${apellidoMaterno[0]}${nombre[0]}` +
`-${anoNacimiento}${mesNacimiento}${diaNacimiento}-XXX`;

// Mostrar el resultado en la página
document.getElementById("resultadoRFC").innerText = rfc;
}