-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathciclos.html
More file actions
81 lines (59 loc) · 1.62 KB
/
Copy pathciclos.html
File metadata and controls
81 lines (59 loc) · 1.62 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<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>
//While - Do while
let contador = 0;
while(contador<10){
console.log("while"+contador);
contador++;
}
do{
console.log("do while"+contador);
contador++;
}while(contador<10);
//For
/*
for([inicializacion de variable]);([condicion]);
([Decremento o incremento]){
sentencias que ejecuta el for
sentencias que ejecuta el for
}
*/
let numero = [10,20,30,40,50,60,70,80,90]
for(let i=0;i<numero.length;i++){
console.log(numero[i])
}
//For in
/*
Nos permite recorrer o iterar los atributos
o propiedades de un objeto
*/
const christian = {
apellido: "Londono",
edad: "26",
pasatiempo: "Trombon"
}
for(const propiedad in christian){
console.log(`key:${propiedad}, Value:${christian[propiedad]}`);
}
//For of
/*
Nos va permitir recorrer cada uno de los elemento de
cualquier objeto que sea iterable en JS
iterable: que se pueda partir en pequeños elementos
*/
for(const elemento of numero){
console.log(elemento);
}
let cadena = "Hola"
for(const caracter of cadena){
console.log(caracter);
}
</script>
</body>
</html>