-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathaula06.03.html
More file actions
31 lines (25 loc) · 821 Bytes
/
aula06.03.html
File metadata and controls
31 lines (25 loc) · 821 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
<!doctype html>
<html>
<head>
<title>Logica de Programação Javascript</title>
<meta charset="utf-8">
</head>
<body>
<h1>Lógica de programação com Javascript</h1>
<div id="output"></div>
</body>
<script>
var produtos = [
{"nome": "caneta", "preco": 2},
{"nome": "lapis", "preco": 1.2},
{"nome": "borracha", "preco": 0.5}
];
var msg = "";
for(var i = 0; i < produtos.length; i++){
console.log(produtos[i].preco);
msg += "<h2>Produto: "+ produtos[i].nome +"</h2>";
msg += "<p>preco: R$ "+ produtos[i].preco +"</p><br>"
}
document.querySelector('#output').innerHTML = msg;
</script>
</html>