-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforIn.html
More file actions
34 lines (29 loc) · 720 Bytes
/
forIn.html
File metadata and controls
34 lines (29 loc) · 720 Bytes
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
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>For In and For Off</title>
<script>
const nome = 'Orion'
const nota = 1
const pessoa = {
nome: 'Orion',
telefone: '(61) 987654321',
endereço: 'ABCDEF'
}
/* for in:
for(let atributo in pessoa){
console.log(atributo + ' -> ' + pessoa[atributo])
}
*/
const carros = ['Gol', 'Fusca', 'Virtus', 'Ka']
//for of:
for(let elemento of carros){
console.log(elemento);
}
console.log(carros[0]);
</script>
</head>
<body>
</body>
</html>