-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharreglos.html
More file actions
59 lines (45 loc) · 1.43 KB
/
Copy patharreglos.html
File metadata and controls
59 lines (45 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
const a = []
const b = [1,true,"hola",["A","B","C",[1,2,3,4]]]
console.log(a)
console.log(b)
console.log(b.length)
console.log(b[2])
console.log(b[3])
console.log(b[3][2])
console.log(b[3][3][3])
const c = Array.of("x","y","z",9,8,7) // Crear Array
console.log (c)
const d = Array(100).fill(false);
console.log(d)
// Forma antigua ------------------------------------
const e = new Array ()
console.log(e)
const f = new Array (1,2,3,4,5,6,7,8,9,"Christian")
console.log(f)
// --------------------------------------------------
// METODOS ARRAY
const colores = ["ROJO","VERDE","AZUL"];
console.log(colores);
colores.push("NEGRO"); // Agrega
console.log(colores);
colores.pop() // quita el ultimo
console.log(colores)
// METODO FOREACH
colores.forEach(function(el,index) {
console.log (`<li id="${index}">${el}</li>`);
})
/* RECIVE UNA FUNCION QUE SE VA EJECUTAR POR
CADA ELEMENTO QUE TENGA, siendo el valor
el (elemento), y el valor index (posicion)
*/
</script>
</body>
</html>