Skip to content

Commit ddeb22b

Browse files
committed
Ders 03
1 parent 1eba53d commit ddeb22b

File tree

1 file changed

+157
-0
lines changed

1 file changed

+157
-0
lines changed

ders03.js

+157
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
// OBJECTS
2+
3+
// property -- method: Bir nesne ile iliskili func
4+
5+
/* const person = {
6+
7+
name: "John",
8+
surname: "Doe",
9+
age: 40,
10+
languages: ["Turkish", "English", "Spanish"],
11+
fullName: function() {
12+
return this.name + " " + this.surname
13+
},
14+
address: {
15+
city: "Balıkesir",
16+
district: "Akçay"
17+
}
18+
19+
} */
20+
21+
// Object Literal
22+
23+
/* const person = {
24+
name: 'John',
25+
surname: 'Doe',
26+
age: 40,
27+
fullName: function() {
28+
return this.name + " " + this.surname
29+
}
30+
}
31+
32+
console.log(person);
33+
34+
// dot Notation
35+
36+
console.log(person.name);
37+
console.log(person.age);
38+
console.log(person.fullName());
39+
40+
person.job = "Student";
41+
42+
console.log(person);
43+
console.log(person.job);
44+
45+
// bracket Notation
46+
47+
console.log(person['name']);
48+
console.log(person['age']);
49+
console.log(person['fullName']());
50+
console.log(person['na' + 'me']) // 'na' + 'me' ---> 'name' */
51+
52+
53+
/* const person = {
54+
name: 'John',
55+
surname: 'Doe',
56+
age: 40,
57+
fullName: function() {
58+
return this.name + " " + this.surname
59+
}
60+
}
61+
62+
const arin = {----}
63+
64+
person.address = {};
65+
66+
console.log(person);
67+
68+
person.address.city = "Balıkesir";
69+
70+
console.log(person); */
71+
72+
/* const person = {
73+
name: 'John',
74+
surname: 'Doe',
75+
age: 40,
76+
fullName: function() {
77+
return this.name + " " + this.surname
78+
}
79+
} */
80+
81+
// CONSTRUCTOR ---> YAPICI
82+
83+
84+
/* function Person(name, surname, age) {
85+
const obj = {};
86+
obj.name = name;
87+
obj.surname = surname;
88+
obj.age = age;
89+
obj.fullName = function() {
90+
return obj.name + " " + obj.surname
91+
}
92+
93+
return obj;
94+
const person2 = new Person("Ricardo", "Quaresma", 38);
95+
console.log(person2);
96+
97+
98+
} */
99+
100+
/* function Person(name, surname, age) {
101+
102+
this.name = name;
103+
this.surname = surname;
104+
this.age = age;
105+
this.fullName = function() {
106+
return this.name + " " + this.surname
107+
}
108+
} */
109+
110+
111+
/* const person1 = new Person("John", "Doe", 40);
112+
const person2 = new Person("Ricardo", "Quaresma", 38); */
113+
114+
/* const person1 = new Person("John", "Doe", 40);
115+
console.log(person1)
116+
console.log(person1.fullName());
117+
118+
const person2 = new Person("Ricardo", "Quaresma", 38);
119+
console.log(person2)
120+
console.log(person2.fullName()); */
121+
122+
123+
// Object Constructor
124+
125+
/* const person1 = new Object();
126+
person1.name = 'John';
127+
person1.surname = 'Doe';
128+
person1.age = 40;
129+
person1.fullName = function() {
130+
console.log(this);
131+
return this.name + " " + this.surname;
132+
}
133+
134+
console.log(person1);
135+
console.log(person1.age);
136+
console.log(person1.fullName()); */
137+
138+
// Object.create() ile nesne olusturmak
139+
140+
/* const person = {
141+
name: 'John',
142+
surname: 'Doe',
143+
age: 40,
144+
fullName: function() {
145+
return this.name + " " + this.surname
146+
}
147+
}
148+
149+
console.log(person);
150+
151+
const arin = Object.create(person);
152+
arin.name = 'Arin';
153+
arin.surname = 'Software';
154+
arin.age = 5;
155+
156+
console.log(arin);
157+
console.log(arin.fullName()); */

0 commit comments

Comments
 (0)