Skip to content

Commit ba0d563

Browse files
committed
20240527_primeraprueba OK
1 parent 237d382 commit ba0d563

File tree

3 files changed

+57
-64
lines changed

3 files changed

+57
-64
lines changed

Entregas/Entrega2/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<script async src="./index.js"></script>
7-
<title>ENTREGA 2 ARRAYS</title>
7+
<title>ENTREGA 2 - ARRAYS</title>
88
</head>
99
<body>
1010
<p>ENTREGA 2 : ARRAYS</p>

Entregas/Entrega2/index.js

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,58 @@
1-
//PRIMERA ENTREGA
2-
//Login basico usando una version con SWITCH y otra con sentencias IF, IF ELSE y WHILE
3-
4-
5-
6-
7-
8-
//-------------------------------------------------
9-
//FUNCION ingreso datos
10-
//-------------------------------------------------
11-
/*
12-
function ingreso (){
13-
const lista = [ "Nombre: ", "Apellido: ", "Cedula: " ];
14-
console.log(lista.values); */
15-
1+
//SEGUNDA ENTREGA
2+
//Pide ingresar datos que van a un Array y luego con ese usuario habilita acceder a sisema
3+
let userdb=[]; //Crea natriz vacia "matriz"
4+
5+
let u;
6+
7+
registro();
8+
login();
9+
10+
11+
/**
12+
* FUNCION REGISTRO USUARIO
13+
*/
14+
function registro (){
15+
16+
let head = ['Nombre', 'Apellido','Cedula','usuario','Password'];
17+
//let x = head.length; //Cuenta los datos a solicitar (Array "head")
18+
19+
// USANDO FOR..OF
20+
for (let d of head) {
21+
dato=prompt("Ingrese "+d+": ");
22+
if (dato ===null){
23+
alert("Debe ingresar usuario");
24+
d=d-1;}
25+
26+
else{
27+
userdb.push([d,dato])};
28+
}
29+
return userdb;
30+
31+
}
32+
33+
/**
34+
* FUNCION LOGIN USUARIO
35+
*/
36+
function login (){
37+
let user;let x=true;
38+
console.log(userdb);
39+
while (x) {
40+
user=prompt("Ingrese un Usuario: ");
41+
42+
43+
if (user === null) {// Verificar si el input es nulo (el usuario canceló el prompt)
44+
alert("Ingrese opcion valida.");
45+
}else if (user !== "") {
46+
let indice = userdb.includes(user);//user es valor buscado en array userdb
47+
48+
if (indice !== -1 && user===userdb[3][1]) {
49+
50+
alert("BIENVENIDO AL SISTEMA ");
51+
console.log("EL USUARIO ES: "+userdb[3][1]);
52+
x=false;
53+
}
54+
}
55+
}
56+
}
1657

17-
/* for (let value of lista) {
18-
dato = prompt ("Ingrese :");
19-
value += 1;
20-
console.log(value);
21-
}*/
22-
/* }
23-
24-
2558

26-
ingreso();
27-
*/

Entregas/PruebasEntrega/index.js

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +0,0 @@
1-
2-
let userdb=[]; //Crea natriz vacia "matriz"
3-
4-
/**
5-
* FUNCION REGISTRO USUARIO
6-
*/
7-
8-
function registro (){
9-
10-
let head = ['Nombre', 'Apellido','Cedula','usuario','Password'];
11-
let x = head.length; //Cuenta los datos a solicitar (Array "head")
12-
13-
// USANDO FOR..OF
14-
for (let d of head) {
15-
dato=prompt("Ingrese "+d+": ");
16-
userdb.push([d,dato]);
17-
}
18-
return userdb;
19-
20-
}
21-
/**
22-
* FUNCION LOGIN USUARIO
23-
*/
24-
/* function login (){
25-
let user=prompt("Ingrese un Usuario: ");
26-
let indice = userdb.indexOf(user);//user es valor buscado en array userdb
27-
if (user==""){
28-
alert('No Ingreso nada');
29-
} else if (indice !== -1) {
30-
alert(`Valor encontrado en el índice ${indice}`);
31-
alert("BIENVENIDO AL SISTEMA ");
32-
log=false;//Para salir del while
33-
} else {
34-
alert("Debe ingresar usuario registrardo.");
35-
} */
36-
37-
38-
registro();

0 commit comments

Comments
 (0)