Skip to content

Commit 53d9d4e

Browse files
committed
first
0 parents  commit 53d9d4e

File tree

4 files changed

+85
-0
lines changed

4 files changed

+85
-0
lines changed

class.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Person {
2+
constructor (name, surname) {
3+
this.ad = name;
4+
this.soyad = surname;
5+
}
6+
7+
selamver() {
8+
return `merhaba ben ${this.ad + " " + this.soyad}`;
9+
}
10+
}
11+
12+
const hazal = new Person('hazal', 'yılmaz');
13+
console.log(hazal.selamver());
14+
15+
const derya = new Person('derya', 'yılmaz');
16+
console.log(derya.selamver());

class1.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
class Person1 {
2+
constructor (name, surname) {
3+
this.ad = name;
4+
this.soyad = surname;
5+
}
6+
7+
selamver() {
8+
return `merhaba ben ${this.ad + " " + this.soyad}`;
9+
}
10+
}
11+
12+
class Ogrenci extends Person1 {
13+
constructor (ad, soyad, yas){
14+
super(ad, soyad);
15+
this.yas = yas;
16+
}
17+
18+
yasi() {
19+
return `ben ${this.yas} yaşındayım`;
20+
}
21+
22+
}
23+
24+
const ayse = new Ogrenci('ayse', 'agdiken', 10);
25+
console.log(ayse.selamver());
26+
console.log(ayse.yasi());

index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
11+
<script src="/static.js"></script>
12+
<script src="/class1.js"></script>
13+
<script src="/class.js"></script>
14+
</body>
15+
</html>

static.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
class Person2 {
2+
3+
static sayac = 0;
4+
5+
constructor (name, surname) {
6+
this.ad = name;
7+
this.soyad = surname;
8+
Person2.sayac++;
9+
}
10+
11+
selamver() {
12+
return `merhaba ben ${this.ad + " " + this.soyad}`;
13+
}
14+
}
15+
16+
class Ogrenci1 extends Person2 {
17+
constructor (ad, soyad, yas){
18+
super(ad, soyad);
19+
this.yas = yas;
20+
}
21+
22+
yasi() {
23+
return `ben ${this.yas} yaşındayım`;
24+
}
25+
26+
}
27+
28+
console.log("oluşturulan person sayısı:" + Person2.sayac);

0 commit comments

Comments
 (0)