-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathders04.js
110 lines (78 loc) · 2.06 KB
/
ders04.js
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// OBJECTS - Part II
/* const person = {
name: 'John',
surname: 'Doe',
age: 40,
fullName: function() {
return this.name + " " + this.surname
}
}
console.log(person);
console.log(person.name);
console.log(person.fullName());
//console.log(person.fullName2());
//console.log(person.job);
console.log(person.toString());
console.log(person.hasOwnProperty("name")); */
// OBJECT + name, surname, age, fullName() ----> person
/* const myObj = {};
console.log(myObj);
console.log(myObj.toString()); */
// OBJECT ---> myObj
/* function Person(name, surname, age) {
this.name = name;
this.surname = surname;
this.age = age;
this.fullName = function() {
return this.name + " " + this.surname
}
} */
/* const arin = new Person("Arin", "Çekiç", 6);
console.log(arin); */
// OBJECT + name, surname, age, fullName() ----> Person ----> arin
/* console.log(arin.toString());
console.log(arin.hasOwnProperty("age"));
console.log(arin.__proto__);
*/
/* const elis = new Person("Elis", "Çekiç", 4);
console.log(elis);
elis.job = "Child";
console.log(elis);
console.log(elis.toString()); */
// OBJECT + name, surname, age, fullName() ----> Person + job ----> elis
/* elis.toString = function() {
return "ELISSSSS";
}
console.log(elis.toString()); */
/* function Person(name, age) {
this.name = name;
this.age = age;
}
Person.prototype.fullName = function() {
return this.name + " " + this.surname
}
Person.prototype.surname = "Çekiç";
const elis = new Person("Elis", 4);
const arin = new Person("Arin", 6);
console.log(elis);
console.log(arin); */
const person = {
name: 'XXXXXXXX',
surname: 'XXXXXX',
age: 0,
fullName: function() {
return this.name + " " + this.surname
}
}
const arin = Object.create(person);
console.log(arin);
console.log(arin.name);
arin.name = "Arin";
console.log(arin);
console.log(arin.age);
arin.age = 6;
console.log(arin.age);
console.log(arin);
console.log(arin.hasOwnProperty("age"));
console.log(arin.hasOwnProperty("surname"));
console.log("surname" in arin);