Skip to content

Commit e828abc

Browse files
Merge pull request #168 from fatmabadri/master
translate 4-elem, 5-why aaa and 12-sort table
2 parents 9039293 + b7e2671 commit e828abc

File tree

7 files changed

+34
-34
lines changed

7 files changed

+34
-34
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The solution is short, yet may look a bit tricky, so here I provide it with extensive comments:
1+
Çözüm kısa, ancak biraz kafa karıştırıcı görünebilir, bu yüzden burada kapsamlı yorumlar sunuyorum:
22

33

44
```js
@@ -9,11 +9,11 @@ let sortedRows = Array.from(table.rows)
99
table.tBodies[0].append(...sortedRows);
1010
```
1111

12-
1. Get all `<tr>`, like `table.querySelectorAll('tr')`, then make an array from them, cause we need array methods.
13-
2. The first TR (`table.rows[0]`) is actually a table header, so we take the rest by `.slice(1)`.
14-
3. Then sort them comparing by the content of the first `<td>` (the name field).
15-
4. Now insert nodes in the right order by `.append(...sortedRows)`.
12+
1. `table.querySelectorAll('tr')` gibi tüm `<tr>`leri al, sonra onlardan bir array yap, çünkü array yöntemlerine ihtiyacımız var.
13+
2. İlk TR (`table.rows[0]`) aslında bir tablo başlığıdır, bu yüzden geri kalanını `.slice(1)` ile alıyoruz.
14+
3. Daha sonra onları ilk `<td>` (isim alanı)'nın içeriği ile karşılaştıryoruz.
15+
4. Şimdi düğümleri `.append(...sortedRows)` olarak doğru sırada ekleyin.
1616

17-
Tables always have an implicit <tbody> element, so we need to take it and insert into it: a simple `table.append(...)` would fail.
18-
19-
Please note: we don't have to remove them, just "re-insert", they leave the old place automatically.
17+
Tabloların doğrudan belirtilmeyen bir <tbody> öğesi vardır, bu yüzden onu alır ve içine ekleriz: basit bir `table.append(...)` başarısız olacaktır.
18+
19+
Lütfen not edin: Onları kaldırmak zorunda değiliz, sadece yeniden ekle ("re-insert"), onlar eski yerlerini kendiliğinden bırakacaktır.

2-ui/1-document/07-modifying-document/12-sort-table/solution.view/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
<table id="table">
66
<tr>
7-
<th>Name</th>
8-
<th>Surname</th>
9-
<th>Age</th>
7+
<th>İsim</th>
8+
<th>Soyisim</th>
9+
<th>Yaş</th>
1010
</tr>
1111
<tr>
1212
<td>John</td>

2-ui/1-document/07-modifying-document/12-sort-table/source.view/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
<table id="table">
66
<tr>
7-
<th>Name</th>
8-
<th>Surname</th>
9-
<th>Age</th>
7+
<th>İsim</th>
8+
<th>Soyisim</th>
9+
<th>Yaş</th>
1010
</tr>
1111
<tr>
1212
<td>John</td>
@@ -26,7 +26,7 @@
2626
</table>
2727

2828
<script>
29-
// ... your code ...
29+
// ... sizin kodunuz ...
3030
</script>
3131

3232
</body>

2-ui/1-document/07-modifying-document/12-sort-table/task.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ importance: 5
44

55
# Sort the table
66

7-
There's a table:
7+
Bir tablo var:
88

99
<table>
1010
<tr>
11-
<th>Name</th>
12-
<th>Surname</th>
13-
<th>Age</th>
11+
<th>İsim</th>
12+
<th>Soyisim</th>
13+
<th>Yaş</th>
1414
</tr>
1515
<tr>
1616
<td>John</td>
@@ -34,6 +34,6 @@ There's a table:
3434
</tr>
3535
</table>
3636

37-
There may be more rows in it.
37+
Belki içinde daha çok satır var.
3838

39-
Write the code to sort it by the `"name"` column.
39+
`"name"` sütunu tarafından sıralanması için kodu buraya yazın.

2-ui/1-document/07-modifying-document/4-clear-elem/solution.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
First, let's see how *not* to do it:
2+
İlk olarak, bunun nasıl *yapılmadığını* görelim:
33

44
```js
55
function clear(elem) {
@@ -9,11 +9,11 @@ function clear(elem) {
99
}
1010
```
1111

12-
That won't work, because the call to `remove()` shifts the collection `elem.childNodes`, so elements start from the index `0` every time. But `i` increases, and some elements will be skipped.
12+
Bu işlemeyecektir, çünkü `remove()` çağrısı `elem.childNodes` koleksiyonunun yerini değiştirir, bu nedenle her seferinde öğeler "0" dizininden başlar. Ama "i" ıle değeri artar ve bazı öğeler atlanmış olabilir.
1313

14-
The `for..of` loop also does the same.
14+
`for..of` döngüsü(loop) de aynısını yapar.
1515

16-
The right variant could be:
16+
Doğru değişken(variant) şöyle olabilir:
1717

1818
```js
1919
function clear(elem) {
@@ -23,7 +23,7 @@ function clear(elem) {
2323
}
2424
```
2525

26-
And also there's a simpler way to do the same:
26+
Ve aynısını yapmanın daha basit bir yolu da var:
2727

2828
```js
2929
function clear(elem) {

2-ui/1-document/07-modifying-document/4-clear-elem/task.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ importance: 5
44

55
# Clear the element
66

7-
Create a function `clear(elem)` that removes everything from the element.
7+
`clear(elem)` adında, elementten herşeyi kaldıran bir fonksiyon yarat.
88

99
```html run height=60
1010
<ol id="elem">
11-
<li>Hello</li>
12-
<li>World</li>
11+
<li>Merhaba</li>
12+
<li>Dünya</li>
1313
</ol>
1414

1515
<script>
16-
function clear(elem) { /* your code */ }
16+
function clear(elem) { /* sizin kodunuz */ }
1717
18-
clear(elem); // clears the list
18+
clear(elem); // listeyi temizler
1919
</script>
2020
```

2-ui/1-document/07-modifying-document/5-why-aaa/task.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ importance: 1
44

55
# Why does "aaa" remain?
66

7-
Run the example. Why does `table.remove()` not delete the text `"aaa"`?
7+
Örneği çalıstırın. Niçin `table.remove()`, `"aaa"` metnini silmez?
88

99
```html height=100 run
1010
<table id="table">
@@ -15,9 +15,9 @@ Run the example. Why does `table.remove()` not delete the text `"aaa"`?
1515
</table>
1616

1717
<script>
18-
alert(table); // the table, as it should be
18+
alert(table); // tablo, olması gerektiği gibi
1919
2020
table.remove();
21-
// why there's still aaa in the document?
21+
// niçin belgenin içinde hala 'aaa' var?
2222
</script>
2323
```

0 commit comments

Comments
 (0)