-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprototype.html
43 lines (33 loc) · 1.02 KB
/
prototype.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
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel">
let a1 = {
cor: 'Azul',
modelo: 'Airbus a300',
levantarVoo: function(){
document.write("O AVIÂO ESTÀ VOANDO")
}
}
let AviaoFactory = function(){
this.cor = 'branco',
this.modelo = 'Boeing a300',
this.levantarVoo = function(){
document.write("O AVIÂO ESTÀ VOANDO")
}
}
let a2 = new AviaoFactory()
console.log(a1)
console.log(a2)
Object.prototype.atrib4 = 'Herdou de Object'
let animal = { atrib1: 'Herdou animal com o proto'}
let vertebrado = { __proto__: animal, atrib2: 'Herdou vertebrado com o proto'}
let ave = { __proto__: vertebrado, atrib3: 'c'}
console.log(ave.atrib2, ave.atrib1, ave.atrib4)
</script>
</head>
<body>
</body>
</html>