-
Notifications
You must be signed in to change notification settings - Fork 0
/
javascript-course5
80 lines (55 loc) · 1.28 KB
/
javascript-course5
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
74
75
76
77
78
79
80
/*var person = {
name: "Max",
"last-name": "Payne",
age: 27,
}
var person2 = new Object();
person2.name = "Anna";
person2.age = 33;
console.log (person2)
var person3 = Object.create(person);
person3.age = 50;
console.log (person3)*/
/*var person = {
name: "Max",
age: 27,
}
Object.prototype.greet = function() {
console.log("Hello There " + this.name + "!");
};
person.greet();
var max = Object.create(person);
max.name = "Maximiliam";
max.greet();
var anna = Object.create(max);
anna.name = "Annastacia";
anna.greet();
console.log(anna.__proto__ == max);
console.log(max.__proto__ == person);
console.log(person.__proto__ == Object.prototype);
console.log(Object.getPrototypeOf(anna));
console.log(Object.getPrototypeOf(max));
console.log(Object.getPrototypeOf(person));*/
function ABC() {
this.name = "Max";
this.age = 12;
this.greet = function(){
console.log("Hello, I am " + this.name + "I'm " + this.age);
}
}
var personX = new ABC();
personX.age = 20;
console.log(personX);
personX.greet();
var personY = new ABC();
personY.age = 35;
console.log(personY);
personY.greet();
function DEF(bla1, bla2) {
this.name = bla1;
this.age = bla2;
}
var personA = new DEF("Axel", 15);
console.log(personA);
var personB = new DEF("Rita", 55);
console.log(personB);