Skip to content

Commit 348fac4

Browse files
authored
Merge pull request Asabeneh#515 from yigittosun/master
Translate 14th and 15th Days to Turkish
2 parents e2587d1 + ee36501 commit 348fac4

File tree

3 files changed

+909
-30
lines changed

3 files changed

+909
-30
lines changed

14_Day_Error_handling/14_day_error_handling.md renamed to 14_Day_Error_handling/13_day_console_object_methods.md

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ ReferenceError: fistName is not defined
8282
at <anonymous>:4:20
8383
In any case it will be executed
8484
```
85-
8685
The catch block take a parameter. It is common to pass e, err or error as a parameter to the catch block. This parameter is an object and it has name and message keys. Lets use the name and message.
87-
8886
```js
8987
try {
9088
let lastName = 'Yetayeh'
@@ -96,22 +94,18 @@ try {
9694
console.log('In any case I will be executed')
9795
}
9896
```
99-
10097
```sh
10198
Name of the error ReferenceError
10299
Error message fistName is not defined
103100
In any case I will be executed
104101
```
105-
106102
throw: the throw statement allows us to create a custom error. We can through a string, number, boolean or an object. Use the throw statement to throw an exception. When you throw an exception, expression specifies the value of the exception. Each of the following throws an exception:
107-
108103
```js
109104
throw 'Error2' // generates an exception with a string value
110105
throw 42 // generates an exception with the value 42
111106
throw true // generates an exception with the value true
112107
throw new Error('Required') // generates an error object with the message of Required
113108
```
114-
115109
```js
116110
const throwErrorExampleFun = () => {
117111
let message
@@ -128,66 +122,43 @@ const throwErrorExampleFun = () => {
128122
}
129123
throwErrorExampleFun()
130124
```
131-
132125
### Error Types
133-
134126
- ReferenceError: An illegal reference has occurred. A ReferenceError is thrown if we use a variable that has not been declared.
135-
136127
```js
137128
let firstName = 'Asabeneh'
138129
let fullName = firstName + ' ' + lastName
139-
140130
console.log(fullName)
141131
```
142-
143132
```sh
144133
Uncaught ReferenceError: lastName is not defined
145134
at <anonymous>:2:35
146135
```
147-
148136
- SyntaxError: A syntax error has occurred
149-
150137
```js
151138
let square = 2 x 2
152139
console.log(square)
153-
154140
console.log('Hello, world")
155141
```
156-
157142
```sh
158143
Uncaught SyntaxError: Unexpected identifier
159144
```
160-
161145
- TypeError: A type error has occurred
162-
163146
```js
164147
let num = 10
165148
console.log(num.toLowerCase())
166149
```
167-
168150
```sh
169151
Uncaught TypeError: num.toLowerCase is not a function
170152
at <anonymous>:2:17
171153
```
172-
173154
These are some of the common error you may face when you write a code. Understanding errors can help you to know what mistakes you made and it will help you to debug your code fast.
174-
175155
🌕 You are flawless. Now, you knew how to handle errors and you can write robust application which handle unexpected user inputs. You have just completed day 14 challenges and you are 14 steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
176-
177156
## Exercises
178-
179157
### Exercises:Level 1
180-
181158
Practice
182-
183159
### Exercises: Level 2
184-
185160
Practice
186-
187161
### Exercises:Level
188-
189162
Practice
190-
191163
🎉 CONGRATULATIONS ! 🎉
192-
193-
[<< Day 13](../13_Day_Console_object_methods/13_day_console_object_methods.md) | [Day 15>>](../15_Day_Classes/15_day_classes.md)
164+
[<< Day 13](../13_Day_Console_object_methods/13_day_console_object_methods.md) | [Day 15>>](../15_Day_Classes/15_day_classes.md)
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
<div align="center">
2+
<h1> 30 Days Of JavaScript: Error handling</h1>
3+
<a class="header-badge" target="_blank" href="https://www.linkedin.com/in/asabeneh/">
4+
<img src="https://img.shields.io/badge/style--5eba00.svg?label=LinkedIn&logo=linkedin&style=social">
5+
</a>
6+
<a class="header-badge" target="_blank" href="https://twitter.com/Asabeneh">
7+
<img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/asabeneh?style=social">
8+
</a>
9+
10+
<sub>Author:
11+
<a href="https://www.linkedin.com/in/asabeneh/" target="_blank">Asabeneh Yetayeh</a><br>
12+
<small> January, 2020</small>
13+
</sub>
14+
15+
</div>
16+
17+
[<< Gün 13](../13_Day_Console_object_methods/13_day_console_object_methods.md) | [Gün 15>>](../15_Day_Classes/15_day_classes.md)
18+
19+
![Thirty Days Of JavaScript](../../images/banners/day_1_14.png)
20+
21+
- [Gün 14](#day-14)
22+
- [Error Handling](#error-handling)
23+
- [Error Types](#error-types)
24+
- [Exercises](#exercises)
25+
- [Exercises:Level 1](#exerciseslevel-1)
26+
- [Exercises: Level 2](#exercises-level-2)
27+
- [Exercises:Level](#exerciseslevel)
28+
29+
# Gün 14
30+
31+
## Error Handling
32+
33+
JavaScript geniş yazılmış bir dildir. Bazı zamanlar, tanımsız bir değişkene erişmeye veya tanımsız bir işlevi çağırmaya çalıştığınızda bir çalışma zamanı hatası alırsınız.
34+
35+
JavaScript, Python veya Java'ya benzer, try-catch-finally bloğunu kullanarak çalışma zamanı hatalarını yakalamak için bir hata işleme mekanizması sağlar.
36+
37+
```js
38+
try {
39+
// hata verilebilicek kod
40+
} catch (err) {
41+
// bir hata oluşursa çalıştırılacak kod
42+
} finally {
43+
// bir hatanın oluşup oluşmadığına bakılmaksızın yürütülecek kod
44+
}
45+
```
46+
47+
**try**: try bloğunda hata oluşturabilecek kodu yazın. try ifadesi, yürütülürken hatalar için test edilecek bir kod bloğu tanımlamamızı sağlar.
48+
49+
**catch**: Bir hata oluştuğunda catch bloğunda bir şeyler yapmak için kod yazın. Catch bloğu, size hata bilgisi verecek parametrelere sahip olabilir. Yakalama bloğu, bir hatayı günlüğe kaydetmek veya kullanıcıya belirli mesajları görüntülemek için kullanılır.
50+
51+
**finally**: finally bloğu, bir hata oluşmasından bağımsız olarak her zaman yürütülür. finally bloğu, kalan görevi tamamlamak veya try bloğunda hata oluşmadan önce değişmiş olabilecek değişkenleri sıfırlamak için kullanılabilir.
52+
53+
**Örnek:**
54+
55+
```js
56+
try {
57+
let lastName = 'Yetayeh'
58+
let fullName = fistName + ' ' + lastName
59+
} catch (err) {
60+
console.log(err)
61+
}
62+
```
63+
64+
```sh
65+
ReferenceError: fistName is not defined
66+
at <anonymous>:4:20
67+
```
68+
69+
```js
70+
try {
71+
let lastName = 'Yetayeh'
72+
let fullName = fistName + ' ' + lastName
73+
} catch (err) {
74+
console.error(err) // we can use console.log() or console.error()
75+
} finally {
76+
console.log('In any case I will be executed')
77+
}
78+
```
79+
80+
```sh
81+
ReferenceError: fistName is not defined
82+
at <anonymous>:4:20
83+
In any case it will be executed
84+
```
85+
86+
Catch bloğu bir parametre alır. Catch bloğuna parametre olarak e, err veya error iletmek yaygındır. Bu parametre bir nesnedir ve isim ve mesaj anahtarlarına sahiptir. Adı ve mesajı kullanalım.
87+
88+
```js
89+
try {
90+
let lastName = 'Yetayeh'
91+
let fullName = fistName + ' ' + lastName
92+
} catch (err) {
93+
console.log('Name of the error', err.name)
94+
console.log('Error message', err.message)
95+
} finally {
96+
console.log('In any case I will be executed')
97+
}
98+
```
99+
100+
```sh
101+
Name of the error ReferenceError
102+
Error message fistName is not defined
103+
In any case I will be executed
104+
```
105+
106+
throw: throw ifadesi özel bir hata oluşturmamıza izin verir. Bir dize, sayı, boolean veya bir nesne aracılığıyla yapabiliriz. Bir istisna atmak için throw ifadesini kullanın. Bir throw exception yazdığınızda, expression specifies değerini belirtir. Aşağıdakilerin her biri throw exception atar:
107+
108+
```js
109+
throw 'Error2' // generates an exception with a string value
110+
throw 42 // generates an exception with the value 42
111+
throw true // generates an exception with the value true
112+
throw new Error('Required') // generates an error object with the message of Required
113+
```
114+
115+
```js
116+
const throwErrorExampleFun = () => {
117+
let message
118+
let x = prompt('Enter a number: ')
119+
try {
120+
if (x == '') throw 'empty'
121+
if (isNaN(x)) throw 'not a number'
122+
x = Number(x)
123+
if (x < 5) throw 'too low'
124+
if (x > 10) throw 'too high'
125+
} catch (err) {
126+
console.log(err)
127+
}
128+
}
129+
throwErrorExampleFun()
130+
```
131+
132+
### Error Types
133+
134+
- ReferenceError: Geçersiz bir referans oluşturur. Tanımlanmamış bir değişken kullanırsak bir ReferenceError atılır.
135+
136+
```js
137+
let firstName = 'Asabeneh'
138+
let fullName = firstName + ' ' + lastName
139+
140+
console.log(fullName)
141+
```
142+
143+
```sh
144+
Uncaught ReferenceError: lastName is not defined
145+
at <anonymous>:2:35
146+
```
147+
148+
- SyntaxError: Bir syntax(sözdizim) hatası oluşturur.
149+
150+
```js
151+
let square = 2 x 2
152+
console.log(square)
153+
154+
console.log('Hello, world")
155+
```
156+
157+
```sh
158+
Uncaught SyntaxError: Unexpected identifier
159+
```
160+
161+
- TypeError: Bir type hatası oluşturur
162+
163+
```js
164+
let num = 10
165+
console.log(num.toLowerCase())
166+
```
167+
168+
```sh
169+
Uncaught TypeError: num.toLowerCase is not a function
170+
at <anonymous>:2:17
171+
```
172+
173+
Bunlar, kod yazarken karşılaşabileceğiniz yaygın hatalardan bazılarıdır. Hataları anlamak, hangi hataları yaptığınızı bilmenize yardımcı olabilir ve kodunuzda hızlı bir şekilde hata ayıklamanıza yardımcı olur.
174+
175+
🌕 Kusursuzsun. Artık hataların nasıl ele alınacağını biliyorsunuz ve beklenmeyen kullanıcı girdilerini işleyen sağlam bir uygulama yazabilirsiniz. 14. gün zorluklarını yeni tamamladınız ve mükemmelliğe giden yolda 14 adım öndesiniz. Şimdi beyniniz ve kasınız için bazı egzersizler yapın.
176+
177+
## Egzersizler
178+
179+
### Egzersiz:Seviye 1
180+
181+
Pratik
182+
183+
### Egzersiz: Seviye 2
184+
185+
Pratik
186+
187+
### Egzersiz: Seviye 3
188+
189+
Pratik
190+
191+
🎉 TEBRİKLER ! 🎉
192+
193+
[<< Gün 13](../13_Day_Console_object_methods/13_day_console_object_methods.md) | [Gün 15>>](../15_Day_Classes/15_day_classes.md)

0 commit comments

Comments
 (0)