-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathaula07.02_b.html
More file actions
73 lines (57 loc) · 1.72 KB
/
aula07.02_b.html
File metadata and controls
73 lines (57 loc) · 1.72 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
<!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>
//Sintaxe formal
var obj = new Object();
obj.nome = "meu objeto";
obj.funcao = function(){
console.log('eu sou um metodo')
}
console.log(obj.nome)
obj.funcao();
//Sintaxe literal
var obj2 = {
nome: "meu objeto 2",
funcao: function(){
console.log("eu sou o metodo do obj2")
}
}
console.log(obj2.nome);
obj2.funcao()
//Objetos customizados
var endereco1 = {
"logradouro": "rua tal",
"numero": 2
}
var endereco2 = {
"logradouro": "rua aquela",
"numero": 20
}
var endereco3 = {
"logradouro": "rua essa",
"numero": 10
}
var minhaArray = new Array(1,2,3)
var hoje = new Date()
var obj3 = new Object()
function Endereco (log, n, cep){
this.logradouro = log
this.n = n
this.cep = cep
this.enderecoCompleto = function(){
return this.logradouro + ', ' + this.n;
}
}
var endereco1 = new Endereco('rua tal', 2, "12345-456")
var endereco2 = new Endereco('rua essa', 10, '45678-987')
console.log(endereco2.enderecoCompleto())
</script>
</html>