Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ importance: 5

# createTextNode vs innerHTML vs textContent

We have an empty DOM element `elem` and a string `text`.
Boş bir DOM elementimiz `elem` ve bir string metnimiz `text` var.

Which of these 3 commands do exactly the same?
Bu 3 komuttan hangisi tamamen aynıdır?

1. `elem.append(document.createTextNode(text))`
2. `elem.innerHTML = text`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ importance: 5

# Insert the HTML in the list

Write the code to insert `<li>2</li><li>3</li>` between two `<li>` here:
Buraya iki `<li>` arasına `<li>2</li><li>3</li>` eklemek için kodu yazın:

```html
<ul id="ul">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
We'll create the table as a string: `"<table>...</table>"`, and then assign it to `innerHTML`.
Tabloyu bir string olarak oluşturacağız: `"<table>...</table>"` ve ardından `innerHTML`'ye atayacağız.

The algorithm:
Algoritma:

1. Create the table header with `<th>` and weekday names.
1. Create the date object `d = new Date(year, month-1)`. That's the first day of `month` (taking into account that months in JavaScript start from `0`, not `1`).
2. First few cells till the first day of the month `d.getDay()` may be empty. Let's fill them in with `<td></td>`.
3. Increase the day in `d`: `d.setDate(d.getDate()+1)`. If `d.getMonth()` is not yet the next month, then add the new cell `<td>` to the calendar. If that's a Sunday, then add a newline <code>"&lt;/tr&gt;&lt;tr&gt;"</code>.
4. If the month has finished, but the table row is not yet full, add empty `<td>` into it, to make it square.
1. Tablo başlığını ve hafta içi gün isimlerini `<th>` ile oluşturun.
1. Tarih nesnesini ile `d = new Date(year, month-1)` oluşturun. Bu, ayın ilk günüdür. (JavaScript'te ayların `1`den değil, `0`dan başladığını hesaba katarak)
2. Ayın ilk gününe kadar ilk birkaç hücre `d.getDay()` boş olabilir. Onları `<td></td>` ile dolduralım.
3. `d`: `d.setDate(d.getDate()+1)` içindeki günü artırın. Eğer `d.getMonth()` henüz gelecek ay değilse, ondan sonra takvime yeni hücre ekle. Eğer bu bir Pazar günüyse, yeni bir satır <code>"&lt;/tr&gt;&lt;tr&gt;"</code>'i ekleyin.
4. Eğer ay bitmişse, ama tablo satırı henüz dolu değilse, onu kare yapmak için içine boş `<td>` ekleyin.
Loading