-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathders10.js
123 lines (84 loc) · 1.86 KB
/
ders10.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
110
111
112
113
114
115
116
117
118
119
120
121
122
// JS Single Thread
// JS Synchronous
/* const func1 = () => {
console.log("Func 1 Console Log 1");
console.log("Func 1 Console Log 2");
alert('Alert Message');
}
const func2 = () => {
console.log("Func 2 Console Log 1");
console.log("Func 2 Console Log 2");
}
func1();
func2(); */
/* let x = 10;
console.log("1. Gelen Veri", x);
setTimeout(() => {
x = x + 5;
}, 1000)
console.log("2. Gelen Veri", x);
x = x + 5;
console.log("3. Gelen Veri", x); */
// Call Stack
/* function func1() {
console.log("Ben birinciyim");
func2();
console.log("Ben tekrar birinciyim");
}
function func2() {
console.log("Ben ikinciyim");
func3();
console.log("Ben tekrar ikinciyim");
}
function func3() {
console.log("Ben üçüncüyüm");
}
func1(); */
/* function add(x, y) {
return x + y;
}
function average(x,y) {
return add(x, y) / 2
}
let x = average(6, 8); */
/* function task(message) {
let n = 10000000000;
while(n > 0) {
n--
}
console.log(message);
}
console.log('1');
setTimeout(()=> {
console.log('2');
}, 1000)
console.log('3');
console.log('4');
task('İşlem Tamamlandı');
setTimeout(()=> {
console.log('5');
}, 2000)
task('İşlem Tamamlandı 2');
*/
/* const myName = () => {
console.log("Benim adım Arin");
}
setTimeout(myName, 3000); */
/* setTimeout(() => {
console.log("Benim adım Arin");
}, 3000); */
const books = [
{name: "Pinball 1973", author: "Haruki Murakami"},
{name: "Özgürlük", author: "Zygmunt Bauman"},
{name: "Turkiye'de Çağdaşlaşma", author:"Niyazi Berkes"}
]
const listBooks = () => {
books.map((book, index) => {
console.log(book, index)
})
}
const addNewBook = (newBook, callback) => {
books.push(newBook)
callback();
}
addNewBook({name: "Berlin Hatıralım", author: "Hüsrev Gerede"}, listBooks);