forked from roque-fernando/projeto_v1
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathex_for.html
51 lines (43 loc) · 1.12 KB
/
ex_for.html
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
<!DOCTYPE html>
<html>
<head>
<title>Aula Lógica de Programação</title>
<meta charset="utf-8">
</head>
<body>
<h1>Lógica de Programação - For</h1>
</body>
<script>
let nomes=["Roque","Marcos","Rita","Vinicius"]
nomes.forEach(function(n,i){
console.log(`nome ${i+1}: ${n}`)
})
//inicializador;condição;iterador
for(let i=1;i<=10;i++){
console.log(i)
}
for(let i=0;i<4;i++){
console.log(nomes[i])
}
for (let n=0;n<5;n++,console.log(` -- ${n}`));
let j=0
for(;j<20;j+=4){
console.log(j)
}
let k=0
for(;;k+=6){
console.log(k)
if(k>=20){
break;
}
}
let w=0
for(;;){
console.log(w)
if(w>=200){
break;
}
w+=60
}
</script>
</html>