-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathders03.js
More file actions
157 lines (115 loc) · 2.81 KB
/
ders03.js
File metadata and controls
157 lines (115 loc) · 2.81 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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
// OBJECTS
// property -- method: Bir nesne ile iliskili func
/* const person = {
name: "John",
surname: "Doe",
age: 40,
languages: ["Turkish", "English", "Spanish"],
fullName: function() {
return this.name + " " + this.surname
},
address: {
city: "Balıkesir",
district: "Akçay"
}
} */
// Object Literal
/* const person = {
name: 'John',
surname: 'Doe',
age: 40,
fullName: function() {
return this.name + " " + this.surname
}
}
console.log(person);
// dot Notation
console.log(person.name);
console.log(person.age);
console.log(person.fullName());
person.job = "Student";
console.log(person);
console.log(person.job);
// bracket Notation
console.log(person['name']);
console.log(person['age']);
console.log(person['fullName']());
console.log(person['na' + 'me']) // 'na' + 'me' ---> 'name' */
/* const person = {
name: 'John',
surname: 'Doe',
age: 40,
fullName: function() {
return this.name + " " + this.surname
}
}
const arin = {----}
person.address = {};
console.log(person);
person.address.city = "Balıkesir";
console.log(person); */
/* const person = {
name: 'John',
surname: 'Doe',
age: 40,
fullName: function() {
return this.name + " " + this.surname
}
} */
// CONSTRUCTOR ---> YAPICI
/* function Person(name, surname, age) {
const obj = {};
obj.name = name;
obj.surname = surname;
obj.age = age;
obj.fullName = function() {
return obj.name + " " + obj.surname
}
return obj;
const person2 = new Person("Ricardo", "Quaresma", 38);
console.log(person2);
} */
/* function Person(name, surname, age) {
this.name = name;
this.surname = surname;
this.age = age;
this.fullName = function() {
return this.name + " " + this.surname
}
} */
/* const person1 = new Person("John", "Doe", 40);
const person2 = new Person("Ricardo", "Quaresma", 38); */
/* const person1 = new Person("John", "Doe", 40);
console.log(person1)
console.log(person1.fullName());
const person2 = new Person("Ricardo", "Quaresma", 38);
console.log(person2)
console.log(person2.fullName()); */
// Object Constructor
/* const person1 = new Object();
person1.name = 'John';
person1.surname = 'Doe';
person1.age = 40;
person1.fullName = function() {
console.log(this);
return this.name + " " + this.surname;
}
console.log(person1);
console.log(person1.age);
console.log(person1.fullName()); */
// Object.create() ile nesne olusturmak
/* const person = {
name: 'John',
surname: 'Doe',
age: 40,
fullName: function() {
return this.name + " " + this.surname
}
}
console.log(person);
const arin = Object.create(person);
arin.name = 'Arin';
arin.surname = 'Software';
arin.age = 5;
console.log(arin);
console.log(arin.fullName()); */