From 3b3c002d78ddd40f0a8b655536d5c4ffb1b85639 Mon Sep 17 00:00:00 2001
From: aliwert <154356044+aliwert@users.noreply.github.com>
Date: Thu, 3 Oct 2024 23:06:05 +0300
Subject: [PATCH 1/3] typos
---
.../02_Day_Data_types/02_day_data_types.md | 868 +++++++++---------
1 file changed, 435 insertions(+), 433 deletions(-)
diff --git a/Turkish/02_Day_Data_types/02_day_data_types.md b/Turkish/02_Day_Data_types/02_day_data_types.md
index 694313f..b688531 100644
--- a/Turkish/02_Day_Data_types/02_day_data_types.md
+++ b/Turkish/02_Day_Data_types/02_day_data_types.md
@@ -7,10 +7,11 @@
- Author:
- Asabeneh Yetayeh
- January, 2020
-
+Author:
+Asabeneh Yetayeh
+ January, 2020
+
+
@@ -19,37 +20,37 @@

- [📔 Gün 2](#-gun-2)
- - [Veri Türleri](#veri-turleri)
- - [İlkel Veri Türleri](#ilkel-veri-türleri)
- - [İlkel Olmayan Veri Türleri](#ilkel-olmayan-veri-türleri)
- - [Sayılar](#sayilar)
- - [Sayı Veri Türlerini Bildirme](#sayı-veri-türleri-bildirme)
- - [Math Nesnesi](#math-nesnesi)
- - [Rastgele Sayı Üretme](#rastgele-sayı-üretme)
- - [Stringler](#stringler)
- - [String Birleştirme](#string-birleştirme)
- - [Toplama Operatörünü Kullanarak Birleştirme](#toplama-operatörü-kullanarak-birleştirme)
- - [Uzun Değişmez String'ler](#uzun-değişmez-stringler)
- - [String'lerdeki Kaçış Dizileri](#strringlerdeki-kaçış-dizileri)
- - [Şablon Değişmezleri](#şablon-değişmezleri)
- - [String Metotları](#string-metotları)
- - [Veri Türlerini Kontrol Etme ve Döküm](#veri-türlerini-kontrol-etme-ve-döküm)
- - [Veri Türlerini Kontrol Etme](#veri-türlerini-kontrol-etme)
- - [Veri Türünü Değiştirme (Döküm)](#veri-türünü-değiştirme-döküm)
- - [String to Int](#string-to-int)
- - [String to Float](#string-to-float)
- - [Float to Int](#float-to-int)
- - [💻 Gün 2: Egzersizler](#-gün-2-egzersizler)
- - [Egzersiz: Seviye 1](#egzersiz-seviye-1)
- - [Egzersiz: Seviye 2](#egzersiz-seviye-2)
- - [Egzersiz: Seviye 3](#egzersiz-seviye-3)
+ - [Veri Türleri](#veri-turleri)
+ - [İlkel Veri Türleri](#ilkel-veri-türleri)
+ - [İlkel Olmayan Veri Türleri](#ilkel-olmayan-veri-türleri)
+ - [Sayılar](#sayilar)
+ - [Sayı Veri Türlerini Bildirme](#sayı-veri-türleri-bildirme)
+ - [Math Nesnesi](#math-nesnesi)
+ - [Rastgele Sayı Üretme](#rastgele-sayı-üretme)
+ - [Stringler](#stringler)
+ - [String Birleştirme](#string-birleştirme)
+ - [Toplama Operatörünü Kullanarak Birleştirme](#toplama-operatörü-kullanarak-birleştirme)
+ - [Uzun Değişmez String'ler](#uzun-değişmez-stringler)
+ - [String'lerdeki Kaçış Dizileri](#strringlerdeki-kaçış-dizileri)
+ - [Şablon Değişmezleri](#şablon-değişmezleri)
+ - [String Metotları](#string-metotları)
+ - [Veri Türlerini Kontrol Etme ve Döküm](#veri-türlerini-kontrol-etme-ve-döküm)
+ - [Veri Türlerini Kontrol Etme](#veri-türlerini-kontrol-etme)
+ - [Veri Türünü Değiştirme (Döküm)](#veri-türünü-değiştirme-döküm)
+ - [String to Int](#string-to-int)
+ - [String to Float](#string-to-float)
+ - [Float to Int](#float-to-int)
+ - [💻 Gün 2: Egzersizler](#-gün-2-egzersizler)
+ - [Egzersiz: Seviye 1](#egzersiz-seviye-1)
+ - [Egzersiz: Seviye 2](#egzersiz-seviye-2)
+ - [Egzersiz: Seviye 3](#egzersiz-seviye-3)
# 📔 Gün 2
-( type çeviri olarak "tür - tip " olarak kullanılabilir. )
+( type çeviri olarak "tür - tip " olarak kullanılabilir. )
Bölüm çevirisini yaparken bazı kelimeleri çevirmedim zira bunları ingilizce halleriyle bilmenizde fayda var.
Örn:
- String vb..
+String vb..
## Veri Türleri
@@ -63,130 +64,129 @@ Veri türleri, verilerin özelliklerini tanımlar. Veri türleri ikiye ayrılabi
JavaScript'teki ilkel veri türleri şunları içerir:
- 1. Numbers - Tamsayılar - Ondalık sayılar
- 2. Strings - Tek tırnak, çift tırnak veya ters tırnak içerisindeki tüm veriler..
- 3. Booleans - true yada false (true = 1 false = 0 bu iki terimi bu şekilde öğrenin. Çevirilerine çok girmeyin kısaca var yada yok )
- 4. Null - Boş değer yada değeri yok
- 5. Undefined - Bir değer verilmeyen değişken. ( Örn: let variables; )
- 6. Symbol - Sembol yapıcısı tarafından oluşturulabilen benzersiz bir değer
+1. Numbers - Tamsayılar - Ondalık sayılar
+2. Strings - Tek tırnak, çift tırnak veya ters tırnak içerisindeki tüm veriler..
+3. Booleans - true ya da false (true = 1 false = 0 bu iki terimi bu şekilde öğrenin. Çevirilerine çok girmeyin kısaca var ya da yok )
+4. Null - Boş değer ya da değeri yok
+5. Undefined - Bir değer verilmeyen değişken. ( Örn: let variables; )
+6. Symbol - Sembol yapıcısı tarafından oluşturulabilen benzersiz bir değer
JavaScript'teki ilkel olmayan veri türleri şunları içerir:
1. Objects ( Nesneler )
-2. Arrays ( Diziler )
-
+2. Arrays ( Diziler )
Şimdi ilkel ve ilkel olmayan veri türlerinin tam olarak ne anlama geldiğini görelim.
-*İlkel* veri türleri değişmez (değiştirilemez) veri türleridir. İlkel bir veri türü oluşturulduktan sonra onu değiştiremeyiz.
+_İlkel_ veri türleri değişmez (değiştirilemez) veri türleridir. İlkel bir veri türü oluşturulduktan sonra onu değiştiremeyiz.
**Örnek:**
```js
-let word = 'JavaScript'
+let word = "JavaScript";
```
-*word* değişkeninde saklanan dizeyi değiştirmeye çalışırsak JavaScript bir hata vermelidir. Tek, çift veya ters tırnak arasındaki herhangi bir veri türü, dize veri türüdür.
-
+_word_ değişkeninde saklanan dizeyi değiştirmeye çalışırsak JavaScript bir hata vermelidir. Tek, çift veya ters tırnak arasındaki herhangi bir veri türü, dize veri türüdür.
+
```js
-word[0] = 'Y'
+word[0] = "Y";
```
-Bu ifade *word* değişkeninde saklanan dizeyi değiştirmez. Yani, string'lerin değiştirilemez ya da başka bir deyişle değişmez olduğunu söyleyebiliriz.
+Bu ifade _word_ değişkeninde saklanan dizeyi değiştirmez. Yani, string'lerin değiştirilemez ya da başka bir deyişle değişmez olduğunu söyleyebiliriz.
İlkel veri türleri değerlerine göre karşılaştırılır. Farklı veri değerlerini karşılaştıralım. Aşağıdaki örneğe bakın:
```js
-let numOne = 3
-let numTwo = 3
+let numOne = 3;
+let numTwo = 3;
-console.log(numOne == numTwo) // true ( Burada iki değişkende 3 e eşit olduğu için birbirine eşit olduğu sonucu çıkıyor )
+console.log(numOne == numTwo); // true ( Burada iki değişkende 3 e eşit olduğu için birbirine eşit olduğu sonucu çıkıyor )
-let js = 'JavaScript'
-let py = 'Python'
+let js = "JavaScript";
+let py = "Python";
-console.log(js == py) //false ( Burada iki değişkende farklı olduğu ve eşitlenemedikleri için false yani 0 değeri dönüyor )
+console.log(js == py); //false ( Burada iki değişkende farklı olduğu ve eşitlenemedikleri için false yani 0 değeri dönüyor )
-let lightOn = true
-let lightOff = false
+let lightOn = true;
+let lightOff = false;
-console.log(lightOn == lightOff) //false ( Yukarıdaki örnek gibi eeşit olmadıkları için false yani 0 değeri dönüyor )
+console.log(lightOn == lightOff); //false ( Yukarıdaki örnek gibi eeşit olmadıkları için false yani 0 değeri dönüyor )
```
### İlkel Olmayan Veri Türleri
-*İlkel olmayan* veri türleri düzenlenebilir veya değiştirilebilir. İlkel olmayan veri türlerinin değerini, oluşturulduktan sonra değiştirebiliriz.
+_İlkel olmayan_ veri türleri düzenlenebilir veya değiştirilebilir. İlkel olmayan veri türlerinin değerini, oluşturulduktan sonra değiştirebiliriz.
Bir dizi oluşturarak görelim. Dizi, köşeli parantez içindeki veri değerlerinin bir listesidir.Diziler aynı veya farklı veri türlerini içerebilir. Dizi değerleri dizin indekslerine ( dizinine ) göre referans alınır. JavaScript'te dizilerin indeksi sıfırdan başlar. Yani bir dizinin ilk elemanı sıfır indeksinde, ikinci elemanı bir indeksinde, üçüncü elemanı iki indeksinde bulunur.
( Orjinal anlatıma bağlı kalmak istiyorum lakin bazen anlamsız olabiliyor. Kısaca diziler okunurken 0-1-2-3 .... şeklinde indekslenir. Bir dizinin ilk elemanına erişmek istiyorsanız indeks numarasına 0 yazmalısınız. Aşağıdaki örneği incelerseniz bu karmaşıklığı çözmüş olacaksınız. )
```js
-let nums = [1, 2, 3]
-nums[0] = 10
+let nums = [1, 2, 3];
+nums[0] = 10;
-console.log(nums) // [10, 2, 3] ( nums değişkeninin ilk elemanı yada 0. indeksinin değerini 10 yapmış oldu )
+console.log(nums); // [10, 2, 3] ( nums değişkeninin ilk elemanı ya da 0. indeksinin değerini 10 yapmış oldu )
```
Gördüğünüz gibi "DİZİ" ilkel olmayan bir veri türü değişkenidir. İlkel olmayan veri türleri değere göre karşılaştırılamaz. İlkel olmayan veri türleri aynı özelliklere ve değerlere sahip olsa bile, kesinlikle eşit değildirler.
```js
-let nums = [1, 2, 3]
-let numbers = [1, 2, 3]
+let nums = [1, 2, 3];
+let numbers = [1, 2, 3];
-console.log(nums == numbers) // false
+console.log(nums == numbers); // false
let userOne = {
-name:'Asabeneh',
-role:'teaching',
-country:'Finland'
-}
+ name: "Asabeneh",
+ role: "teaching",
+ country: "Finland",
+};
let userTwo = {
-name:'Asabeneh',
-role:'teaching',
-country:'Finland'
-}
+ name: "Asabeneh",
+ role: "teaching",
+ country: "Finland",
+};
-console.log(userOne == userTwo) // false
+console.log(userOne == userTwo); // false
```
Temel kural, ilkel olmayan veri türlerini karşılaştıramıyoruz. Dizileri (arrays), fonksiyonları (functions) veya nesneleri (objects) karşılaştırmayın.
İlkel olmayan değerler, değer yerine referansla karşılaştırıldıkları için referans türleri olarak adlandırılır. İki nesne, yalnızca aynı temel nesneye atıfta bulunuyorlarsa kesinlikle eşittir.
```js
-let nums = [1, 2, 3]
-let numbers = nums
+let nums = [1, 2, 3];
+let numbers = nums;
-console.log(nums == numbers) // true ( değişken oluştururken numbers'ın değerini nums'a eşitlediği için bunun sonucu true dönmektedir.)
+console.log(nums == numbers); // true ( değişken oluştururken numbers'ın değerini nums'a eşitlediği için bunun sonucu true dönmektedir.)
let userOne = {
-name:'Asabeneh',
-role:'teaching',
-country:'Finland'
-}
+ name: "Asabeneh",
+ role: "teaching",
+ country: "Finland",
+};
-let userTwo = userOne
+let userTwo = userOne;
-console.log(userOne == userTwo) // true ( yukarıdaki ile aynı )
+console.log(userOne == userTwo); // true ( yukarıdaki ile aynı )
```
-İlkel veri türleri ile ilkel olmayan veri türleri arasındaki farkı anlamakta zorluk çekiyorsan, bunu yaşayan tek kişi değilsin. Sakin ol ve bir sonraki bölüme geç ve bir süre sonra geri gelip burayı tekrar incele. Şimdi sayı türlerine göre veri türlerine başlayalım.
+İlkel veri türleri ile ilkel olmayan veri türleri arasındaki farkı anlamakta zorluk çekiyorsan, bunu yaşayan tek kişi değilsin. Sakin ol ve bir sonraki bölüme geç ve bir süre sonra geri gelip burayı tekrar incele. Şimdi sayı türlerine göre veri türlerine başlayalım.
## Sayılar
-Sayılar, tüm aritmetik işlemleri yapabilen tam sayılar ve ondalık değerlerdir.
+Sayılar, tüm aritmetik işlemleri yapabilen tam sayılar ve ondalık değerlerdir.
Hadi sayılar ile ilgili bazı örnekler görelim.
### Sayı Veri Türlerini Bildirme
```js
-let age = 35
-const gravity = 9.81 // yer çekimi kuvvet değeri bu değer haliyle değişmeyeceği için const olarak tanımlanıyor. Değişmez değişkenleri const ile tanımlarsınız. Bunu unutmayın.
-let mass = 72 // kilogram cinsinden kütle
-const PI = 3.14 // pi sayısı matematikte sabit bir sayı olduğu için const ile oluşturulmuş. ( küsüratı almamış )
+let age = 35;
+const gravity = 9.81; // yer çekimi kuvvet değeri bu değer haliyle değişmeyeceği için const olarak tanımlanıyor. Değişmez değişkenleri const ile tanımlarsınız. Bunu unutmayın.
+let mass = 72; // kilogram cinsinden kütle
+const PI = 3.14; // pi sayısı matematikte sabit bir sayı olduğu için const ile oluşturulmuş. ( küsuratı almamış )
// daha fazla örnek
-const boilingPoint = 100 // derece cinsinden sıcaklık, suyun sabit olan kaynama noktası ( derecesi )
-const bodyTemp = 37 // derece. İnsan vücudun sabit olan ortalama sıcaklığı
+const boilingPoint = 100; // derece cinsinden sıcaklık, suyun sabit olan kaynama noktası ( derecesi )
+const bodyTemp = 37; // derece. İnsan vücudunun sabit olan ortalama sıcaklığı
-console.log(age, gravity, mass, PI, boilingPoint, bodyTemp)
+console.log(age, gravity, mass, PI, boilingPoint, bodyTemp);
```
### Matematik Nesnesi - Objesi ( Math Object )
@@ -194,61 +194,61 @@ console.log(age, gravity, mass, PI, boilingPoint, bodyTemp)
JavaScript'te Math Objesi, sayılar ile çalışmanız için birçok yöntem sağlar.
```js
-const PI = Math.PI // Buraya kısa bir açıklama getirelim. Math objesi sayesinde PI sayısının değerini otomatik alıyoruz.
+const PI = Math.PI; // Buraya kısa bir açıklama getirelim. Math nesnesi sayesinde PI sayısının değerini otomatik alıyoruz.
-console.log(PI) // 3.141592653589793
+console.log(PI); // 3.141592653589793
// En yakın sayıya yuvarlama
// Eğer .5'in altındaysa aşağıya üstündeyse yukarıya yuvarlar. Örn: 3.14 ise 3 yapar 3.51 ise 4 yapar.
-console.log(Math.round(PI)) // 3.14 olduğu için 3 e yuvarlama yapıyor
+console.log(Math.round(PI)); // 3.14 olduğu için 3 e yuvarlama yapıyor
-console.log(Math.round(9.81)) // Ondası 0.5 üstünde olduğu için 10 yapar
+console.log(Math.round(9.81)); // Ondası 0.5 üstünde olduğu için 10 yapar
-console.log(Math.floor(PI)) // floor aşağı yuvarlar Bu 3 olur
+console.log(Math.floor(PI)); // floor aşağı yuvarlar Bu 3 olur
-console.log(Math.ceil(PI)) // ceil yukarı yuvarlar Bu 4 olur
+console.log(Math.ceil(PI)); // ceil yukarı yuvarlar Bu 4 olur
-console.log(Math.min(-5, 3, 20, 4, 5, 10)) // En küçük sayıyı bulmaya yaradığı için sonuç -5 döner
+console.log(Math.min(-5, 3, 20, 4, 5, 10)); // En küçük sayıyı bulmaya yaradığı için sonuç -5 döner
-console.log(Math.max(-5, 3, 20, 4, 5, 10)) // En büyük sayıyı bulmaya yaradığı için sonuç 20 döner
+console.log(Math.max(-5, 3, 20, 4, 5, 10)); // En büyük sayıyı bulmaya yaradığı için sonuç 20 döner
-const randNum = Math.random() // 0 ile 0.999999 arasında rastgele bir sayı üretir.
-console.log(randNum)
+const randNum = Math.random(); // 0 ile 0.999999 arasında rastgele bir sayı üretir.
+console.log(randNum);
// 0 ile 10 arasında rastgele bir sayı oluşturalım.
-const num = Math.floor(Math.random () * 11) // 0 ile 10 arasında rastgele sayı oluşturur
-console.log(num)
+const num = Math.floor(Math.random() * 11); // 0 ile 10 arasında rastgele sayı oluşturur
+console.log(num);
//Mutlak değer
-console.log(Math.abs(-10)) // 10
+console.log(Math.abs(-10)); // 10
//Kare kök
-console.log(Math.sqrt(100)) // 10
+console.log(Math.sqrt(100)); // 10
-console.log(Math.sqrt(2)) // 1.4142135623730951
+console.log(Math.sqrt(2)); // 1.4142135623730951
// Üs
-console.log(Math.pow(3, 2)) // 9
+console.log(Math.pow(3, 2)); // 9
-console.log(Math.E) // 2.718
+console.log(Math.E); // 2.718
// Logaritma
// Returns the natural logarithm with base E of x, Math.log(x)
-console.log(Math.log(2)) // 0.6931471805599453
-console.log(Math.log(10)) // 2.302585092994046
+console.log(Math.log(2)); // 0.6931471805599453
+console.log(Math.log(10)); // 2.302585092994046
// Sırasıyla 2 ve 10'un doğal logaritmasını döndürür
-console.log(Math.LN2) // 0.6931471805599453
-console.log(Math.LN10) // 2.302585092994046
+console.log(Math.LN2); // 0.6931471805599453
+console.log(Math.LN10); // 2.302585092994046
// Trigonometri
-Math.sin(0)
-Math.sin(60)
+Math.sin(0);
+Math.sin(60);
-Math.cos(0)
-Math.cos(60)
+Math.cos(0);
+Math.cos(60);
```
#### Rastgele Sayı Üretme
@@ -256,43 +256,43 @@ Math.cos(60)
JavaScript'te Math nesnesi random() methodu 0 ile 0,999999999 arasında bir sayı üretir
```js
-let randomNum = Math.random() // 0 ile 0.999999999 arasında bir sayı üretir
+let randomNum = Math.random(); // 0 ile 0.999999999 arasında bir sayı üretir
```
Şimdi 0 ile 10 arasında rastgele bir sayı üretmek için random() methodu'nu nasıl kullanabileceğimizi görelim:
```js
-let randomNum = Math.random() // 0 ile 0.999 arasında oluşturur
-let numBtnZeroAndTen = randomNum * 11
+let randomNum = Math.random(); // 0 ile 0.999 arasında oluşturur
+let numBtnZeroAndTen = randomNum * 11;
-console.log(numBtnZeroAndTen) // Sonuç : minimum 0 ve maksimum 10.99
+console.log(numBtnZeroAndTen); // Sonuç : minimum 0 ve maksimum 10.99
-let randomNumRoundToFloor = Math.floor(numBtnZeroAndTen) // yuvarlama yapıyor
-console.log(randomNumRoundToFloor) // Sonuç 0 ile 10 arasında çıkar
+let randomNumRoundToFloor = Math.floor(numBtnZeroAndTen); // yuvarlama yapıyor
+console.log(randomNumRoundToFloor); // Sonuç 0 ile 10 arasında çıkar
```
-## Strings
+## Strings
Dizeler **_tek_**, **_çift_** ve **_ters tırnak_** arasındaki metinlerdir.
-Bir dize bildirmek için değişken adına, atama operatörüne, tek tırnak, çift tırnak veya ters tırnak içerisinde bir değere ihtiyacımız var.
+Bir dize bildirmek için değişken adına, atama operatörüne, tek tırnak, çift tırnak veya ters tırnak içerisinde bir değere ihtiyacımız var.
Bazı dize örnekleri görelim:
```js
-let space = ' ' // boş alan string tek tırnaklı
-let firstName = 'Asabeneh' // tek tırnaklı string
-let lastName = 'Yetayeh' // tek tırnaklı string
-let country = 'Finland' // tek tırnaklı string
-let city = 'Helsinki' // tek tırnaklı string
-let language = 'JavaScript' // tk tırnaklı string
-let job = 'teacher' // tek tırnaklı string
-let quote = "The saying,'Seeing is Believing' is not correct in 2020." // çift tırnaklı string
-let quotWithBackTick = `The saying,'Seeing is Believing' is not correct in 2020.` // ters tırnaklı string (bu karakteri genellikle klavyenizdeki noktalı virgülü kullanarak yaparsınız. Benim klavyemde alt gr + noktalı virgül ve iki kere tıklanınca çıkıyor)
+let space = " "; // boş alan string tek tırnaklı
+let firstName = "Asabeneh"; // tek tırnaklı string
+let lastName = "Yetayeh"; // tek tırnaklı string
+let country = "Finland"; // tek tırnaklı string
+let city = "Helsinki"; // tek tırnaklı string
+let language = "JavaScript"; // tek tırnaklı string
+let job = "teacher"; // tek tırnaklı string
+let quote = "The saying,'Seeing is Believing' is not correct in 2020."; // çift tırnaklı string
+let quotWithBackTick = `The saying,'Seeing is Believing' is not correct in 2020.`; // ters tırnaklı string (bu karakteri genellikle klavyenizdeki noktalı virgülü kullanarak yaparsınız. Benim klavyemde alt gr + noktalı virgül ve iki kere tıklanınca çıkıyor)
```
### String Birleştirme
İki veya daha fazla string'i birbirine bağlama işlemine birleştirme denir.
-Yukarda bulunan string örneklerini kullanarak:
+Yukarda bulunan string örneklerini kullanarak:
```js
let fullName = firstName + space + lastName; // birleştirme, iki string'i bir araya getirme.
@@ -300,10 +300,10 @@ console.log(fullName);
```
```sh
-Asabeneh Yetayeh
+Asabeneh Yetayeh
```
-String'leri farklı şekildede birleştirebiliriz.
+String'leri farklı şekilde de birleştirebiliriz.
#### Toplama Operatörünü Kullanarak Birleştirme
@@ -311,66 +311,69 @@ Ekleme operatörü kullanarak birleştirme eski bir yöntemdir. Bu birleştirme
```js
// Farklı veri türlerini oluşturma
-let space = ' '
-let firstName = 'Asabeneh'
-let lastName = 'Yetayeh'
-let country = 'Finland'
-let city = 'Helsinki'
-let language = 'JavaScript'
-let job = 'teacher'
-let age = 250
-
+let space = " ";
+let firstName = "Asabeneh";
+let lastName = "Yetayeh";
+let country = "Finland";
+let city = "Helsinki";
+let language = "JavaScript";
+let job = "teacher";
+let age = 250;
-let fullName =firstName + space + lastName
-let personInfoOne = fullName + '. I am ' + age + '. I live in ' + country; // ES5 toplama operatörü ile değişkenleri birleştiriyor
+let fullName = firstName + space + lastName;
+let personInfoOne = fullName + ". I am " + age + ". I live in " + country; // ES5 toplama operatörü ile değişkenleri birleştiriyor
-console.log(personInfoOne)
+console.log(personInfoOne);
```
```sh
-Asabeneh Yetayeh. I am 250. I live in Finland
+Asabeneh Yetayeh. I am 250. I live in Finland
```
#### Uzun Değişmez Stringler
-Stringler tek bir karakter, paragraf yada sayfa olabilir. String uzunluğu çok büyükse tek bir satıra sığmayabilir. String'in bir sonraki satırda devam edeceğini belirtmek için her satırın sonunda ters eğik çizgi karakterini (\\) kullanabiliriz.
+Stringler tek bir karakter, paragraf ya da sayfa olabilir. String uzunluğu çok büyükse tek bir satıra sığmayabilir. String'in bir sonraki satırda devam edeceğini belirtmek için her satırın sonunda ters eğik çizgi karakterini (\\) kullanabiliriz.
**Örnek:**
```js
// burada kendinden bahseden bir paragraf yazmış. Bunuda çevirmeyelim :D
-const paragraph = "My name is Asabeneh Yetayeh. I live in Finland, Helsinki.\
+const paragraph =
+ "My name is Asabeneh Yetayeh. I live in Finland, Helsinki.\
I am a teacher and I love teaching. I teach HTML, CSS, JavaScript, React, Redux, \
Node.js, Python, Data Analysis and D3.js for anyone who is interested to learn. \
In the end of 2019, I was thinking to expand my teaching and to reach \
to global audience and I started a Python challenge from November 20 - December 19.\
It was one of the most rewarding and inspiring experience.\
Now, we are in 2020. I am enjoying preparing the 30DaysOfJavaScript challenge and \
-I hope you are enjoying too."
+I hope you are enjoying too.";
-console.log(paragraph)
+console.log(paragraph);
```
#### String'lerdeki Kaçış Dizileri
-JavaScript ve diğer programlama dillerinde \ (ters eğik çizgi ) ardından bazı karakterler kaçış dizisidir. En yaygın kaçış karakterlerini görelim:
+
+JavaScript ve diğer programlama dillerinde \ (ters eğik çizgi ) ardından bazı karakterler kaçış dizisidir. En yaygın kaçış karakterlerini görelim:
- \n: yeni satır
- \t: Tab, 8 boşluk anlamına gelir ( klavyedeki tab tuşunu temsil eder )
- \\\\: Ters eğik çizgi
- \\': Tek Tırnak (')
- \\": Çift Tırnak (")
-
+
```js
// kodları console kısmına yazarak denerseniz daha iyi anlarsınız.
-console.log('I hope everyone is enjoying the 30 Days Of JavaScript challenge.\nDo you ?') // Buradakı \n satır sonu anlamına gelir sonrası aşağı iner
-console.log('Days\tTopics\tExercises') // Burada her kelimeden sonra bir tab (\t) tuşuna basılmış etkisi verir
-console.log('Day 1\t3\t5') // \t bir başka örnek
-console.log('Day 2\t3\t5') // \t bir başka örnek
-console.log('Day 3\t3\t5') // \t bir başka örnek
-console.log('Day 4\t3\t5') // \t bir başka örnek
-console.log('This is a backslash symbol (\\)') // Ters eğik çizgi yazmak için \\ kullanılıyor
-console.log('In every programming language it starts with \"Hello, World!\"') // Hello World'ü çift tırnak içine almak için \" Hello World \" kullanılıyor.
-console.log("In every programming language it starts with \'Hello, World!\'") // Hello World'ü tek tırnak içine almak için \' Hello World \' kullanılıyor.
-console.log('The saying \'Seeing is Believing\' isn\'t correct in 2020') // Bu kısımdada alıntıları kullanmak için \ kullanımı gösterilmiş.
+console.log(
+ "I hope everyone is enjoying the 30 Days Of JavaScript challenge.\nDo you ?"
+); // Buradaki \n satır sonu anlamına gelir sonrası aşağı iner
+console.log("Days\tTopics\tExercises"); // Burada her kelimeden sonra bir tab (\t) tuşuna basılmış etkisi verir
+console.log("Day 1\t3\t5"); // \t bir başka örnek
+console.log("Day 2\t3\t5"); // \t bir başka örnek
+console.log("Day 3\t3\t5"); // \t bir başka örnek
+console.log("Day 4\t3\t5"); // \t bir başka örnek
+console.log("This is a backslash symbol (\\)"); // Ters eğik çizgi yazmak için \\ kullanılıyor
+console.log('In every programming language it starts with "Hello, World!"'); // Hello World'ü çift tırnak içine almak için \" Hello World \" kullanılıyor.
+console.log("In every programming language it starts with 'Hello, World!'"); // Hello World'ü tek tırnak içine almak için \' Hello World \' kullanılıyor.
+console.log("The saying 'Seeing is Believing' isn't correct in 2020"); // Bu kısımda da alıntıları kullanmak için \ kullanımı gösterilmiş.
```
Konsol çıktıları :
@@ -391,41 +394,39 @@ The saying 'Seeing is Believing' isn't correct in 2020
#### Şablon Değişmezleri (Şablon String'ler)
-Şablon string'leri oluşturmak için iki ters tırnak kullanıyoruz. Verileri bir şablon string'i içine ifade olarak ekleme yapabiliriz. Verileri eklemek için, ifadeyi $ (dolar) işareti ile başlayan bir küme parantezinin "{}" içine alırız. Aşağıdaki sözdizimine bakın.
+Şablon string'leri oluşturmak için iki ters tırnak kullanıyoruz. Verileri bir şablon string'i içine ifade olarak ekleme yapabiliriz. Verileri eklemek için, ifadeyi $ (dolar) işareti ile başlayan bir küme parantezinin "{}" içine alırız. Aşağıdaki sözdizimine bakın.
```js
//Syntax
-`String literal text`
-`String literal text ${expression}`
+`String literal text``String literal text ${expression}`;
```
**Örnek : 1**
```js
-console.log(`The sum of 2 and 3 is 5`) // statik bir veri
-let a = 2
-let b = 3
-console.log(`The sum of ${a} and ${b} is ${a + b}`) // verileri dinamik olarak ekleme
+console.log(`The sum of 2 and 3 is 5`); // statik bir veri
+let a = 2;
+let b = 3;
+console.log(`The sum of ${a} and ${b} is ${a + b}`); // verileri dinamik olarak ekleme
```
**Örnek :2**
```js
-
// Bu kısımda yazar + kullanarak ekleme yapmanın diğer yöntemi olan ES6 ekleme yöntemini gösteriyor. Bu daha stabil çalışıyor.
-let firstName = 'Asabeneh'
-let lastName = 'Yetayeh'
-let country = 'Finland'
-let city = 'Helsinki'
-let language = 'JavaScript'
-let job = 'teacher'
-let age = 250
-let fullName = firstName + ' ' + lastName
+let firstName = "Asabeneh";
+let lastName = "Yetayeh";
+let country = "Finland";
+let city = "Helsinki";
+let language = "JavaScript";
+let job = "teacher";
+let age = 250;
+let fullName = firstName + " " + lastName;
-let personInfoTwo = `I am ${fullName}. I am ${age}. I live in ${country}.` //ES6 - dize ekleme yöntemi ( ES5 yukarda gösterilmişti )
-let personInfoThree = `I am ${fullName}. I live in ${city}, ${country}. I am a ${job}. I teach ${language}.`
-console.log(personInfoTwo)
-console.log(personInfoThree)
+let personInfoTwo = `I am ${fullName}. I am ${age}. I live in ${country}.`; //ES6 - dize ekleme yöntemi ( ES5 yukarda gösterilmişti )
+let personInfoThree = `I am ${fullName}. I live in ${city}, ${country}. I am a ${job}. I teach ${language}.`;
+console.log(personInfoTwo);
+console.log(personInfoThree);
```
```sh
@@ -433,12 +434,12 @@ I am Asabeneh Yetayeh. I am 250. I live in Finland.
I am Asabeneh Yetayeh. I live in Helsinki, Finland. I am a teacher. I teach JavaScript.
```
-Bir string şablonu veya interpolasyon ( matematiksel bir terim ) yöntemi kullanarak, bir değer olabilecek ifadeler veya bazı işlemler ekleyebiliriz.(karşılaştırma, aritmetik işlemler, üçlü işlem)
+Bir string şablonu veya interpolasyon ( matematiksel bir kavram ) yöntemi kullanarak, bir değer olabilecek ifadeler veya bazı işlemler ekleyebiliriz.(karşılaştırma, aritmetik işlemler, üçlü işlem)
```js
-let a = 2
-let b = 3
-console.log(`${a} is greater than ${b}: ${a > b}`) // a b den büyüktür yazıyor ve interpolasyon metodu bunun yanlış olduğunu söylecek
+let a = 2;
+let b = 3;
+console.log(`${a} is greater than ${b}: ${a > b}`); // a b den büyüktür yazıyor ve interpolasyon metodu bunun yanlış olduğunu söyleyecek
```
```sh
@@ -449,321 +450,322 @@ console.log(`${a} is greater than ${b}: ${a > b}`) // a b den büyüktür yazıy
JavaScript'teki her şey bir nesnedir. Bir string ilkel veri türüyse bunu değiştiremeyiz. String bir nesnenin, birçok string metodu vardır. Birçok string metodu bulunmaktadır, bunlar string'ler ile çalışmamıza yardımcı olurlar. ( stringlerin özelliklerini vb bulma metodları bunlar Örneğe bakın)
-1. *length*: String içerisindeki karakterlerin sayısını belirtir. Boşluklar dahildir.
+1. _length_: String içerisindeki karakterlerin sayısını belirtir. Boşluklar dahildir.
**Örnek :**
```js
-let js = 'JavaScript'
-console.log(js.length) // 10
-let firstName = 'Asabeneh'
-console.log(firstName.length) // 8
+let js = "JavaScript";
+console.log(js.length); // 10
+let firstName = "Asabeneh";
+console.log(firstName.length); // 8
```
-2. *String'deki karakterlere erişim*: String içerisinde bulunan her karaktere indeks numarasıyla erişebiliriz. Programlamada sayma 0 dan başlar. String'in ilk dizini 0, son dizini ise toplam uzunluğun -1'dir. ( Kısaca 10 karakter varsa sıralama 0-9 arasında yapılıyor. Resme bakın daha iyi anlayacaksınız.)
+2. _String'deki karakterlere erişim_: String içerisinde bulunan her karaktere indeks numarasıyla erişebiliriz. Programlamada sayma 0 dan başlar. String'in ilk dizini 0, son dizini ise toplam uzunluğun -1'dir. ( Kısaca 10 karakter varsa sıralama 0-9 arasında yapılıyor. Resme bakın daha iyi anlayacaksınız.)
+
+
- 
-
-'JavaScript' string'indeki farklı karakterlere erişelim.
+'JavaScript' string'indeki farklı karakterlere erişelim.
```js
-let string = 'JavaScript'
-let firstLetter = string[0]
+let string = "JavaScript";
+let firstLetter = string[0];
-console.log(firstLetter) // J
+console.log(firstLetter); // J
-let secondLetter = string[1] // a
-let thirdLetter = string[2]
-let lastLetter = string[9]
+let secondLetter = string[1]; // a
+let thirdLetter = string[2];
+let lastLetter = string[9];
-console.log(lastLetter) // t
+console.log(lastLetter); // t
-let lastIndex = string.length - 1
+let lastIndex = string.length - 1;
-console.log(lastIndex) // 9
-console.log(string[lastIndex]) // t
+console.log(lastIndex); // 9
+console.log(string[lastIndex]); // t
```
-3. *toUpperCase()*: bu metot string verisini büyük harflere dönüştürür.
+3. _toUpperCase()_: bu metot string'i büyük harflere dönüştürür.
```js
-let string = 'JavaScript'
+let string = "JavaScript";
-console.log(string.toUpperCase()) // JAVASCRIPT
+console.log(string.toUpperCase()); // JAVASCRIPT
-let firstName = 'Asabeneh'
+let firstName = "Asabeneh";
-console.log(firstName.toUpperCase()) // ASABENEH
+console.log(firstName.toUpperCase()); // ASABENEH
-let country = 'Finland'
+let country = "Finland";
-console.log(country.toUpperCase()) // FINLAND
+console.log(country.toUpperCase()); // FINLAND
```
-4. *toLowerCase()*: bu metot string verisini küçük harflere dönüştürür.
+4. _toLowerCase()_: bu metot string verisini küçük harflere dönüştürür.
```js
-let string = 'JavasCript'
+let string = "JavasCript";
-console.log(string.toLowerCase()) // javascript
+console.log(string.toLowerCase()); // javascript
-let firstName = 'Asabeneh'
+let firstName = "Asabeneh";
-console.log(firstName.toLowerCase()) // asabeneh
+console.log(firstName.toLowerCase()); // asabeneh
-let country = 'Finland'
+let country = "Finland";
-console.log(country.toLowerCase()) // finland
+console.log(country.toLowerCase()); // finland
```
-5. *substr()*: İki arrgüman alır, başlangıç indeksi ve silenecek karakter sayısı.
+5. _substr()_: İki argüman alır, başlangıç indeksi ve alınacak karakter sayısı.
```js
-let string = 'JavaScript'
-console.log(string.substr(4,6)) // Script
+let string = "JavaScript";
+console.log(string.substr(4, 6)); // Script
-let country = 'Finland'
-console.log(country.substr(3, 4)) // land
+let country = "Finland";
+console.log(country.substr(3, 4)); // land
```
-6. *substring()*: Başlangıç indeksi ve durma indeksi olmak üzere iki argüman almaktadır.
+6. _substring()_: Başlangıç indeksi ve bitiş indeksi olmak üzere iki argüman almaktadır.
```js
-let string = 'JavaScript'
+let string = "JavaScript";
-console.log(string.substring(0,4)) // Java
-console.log(string.substring(4,10)) // Script
-console.log(string.substring(4)) // Script
+console.log(string.substring(0, 4)); // Java
+console.log(string.substring(4, 10)); // Script
+console.log(string.substring(4)); // Script
-let country = 'Finland'
+let country = "Finland";
-console.log(country.substring(0, 3)) // Fin
-console.log(country.substring(3, 7)) // land
-console.log(country.substring(3)) // land
+console.log(country.substring(0, 3)); // Fin
+console.log(country.substring(3, 7)); // land
+console.log(country.substring(3)); // land
```
-7. *split()*: Bu metot bir stringi belirtilen yerden bölmeye yarar. ( array oluşturuyor )
+7. _split()_: Bu metot bir stringi belirtilen yerden bölmeye yarar. ( dizi oluşturuyor )
```js
-let string = '30 Days Of JavaScript'
+let string = "30 Days Of JavaScript";
-console.log(string.split()) // bu kısımda birşey belirtmediğin için 1 elementli array oluştu -> ["30 Days Of JavaScript"]
-console.log(string.split(' ')) // bu kısımda boşluktan böl dediğimiz için 4 elementli array oluştu -> ["30", "Days", "Of", "JavaScript"]
+console.log(string.split()); // bu kısımda birşey belirtmediğin için 1 elementli dizi oluştu -> ["30 Days Of JavaScript"]
+console.log(string.split(" ")); // bu kısımda boşluktan böl dediğimiz için 4 elementli dizi oluştu -> ["30", "Days", "Of", "JavaScript"]
-let firstName = 'Asabeneh'
+let firstName = "Asabeneh";
-console.log(firstName.split()) // - > ["Asabeneh"]
-console.log(firstName.split('')) // burada sadece tek tırnak kullandığımız için string'in içindeki tüm karakterleri array haline getirdi -> ["A", "s", "a", "b", "e", "n", "e", "h"]
+console.log(firstName.split()); // - > ["Asabeneh"]
+console.log(firstName.split("")); // burada sadece tek tırnak kullandığımız için string'in içindeki tüm karakterleri dizi haline getirdi -> ["A", "s", "a", "b", "e", "n", "e", "h"]
-let countries = 'Finland, Sweden, Norway, Denmark, and Iceland'
+let countries = "Finland, Sweden, Norway, Denmark, and Iceland";
-console.log(countries.split(',')) // Dikkat edin sadece virgül ile ayırıyor. İknci elementin solunda boşluk oluşuyor. ["Finland", " Sweden", " Norway", " Denmark", " and Iceland"]
-console.log(countries.split(', ')) // Dikkat edin burayada. ', ' virgül ve boşluk bulunmakta bu yüzden elementleri virgülden ayırıp boşluklsuz arrray oluşturuyor. ["Finland", "Sweden", "Norway", "Denmark", "and Iceland"]
+console.log(countries.split(",")); // Dikkat edin sadece virgül ile ayırıyor. İknci elementin solunda boşluk oluşuyor. ["Finland", " Sweden", " Norway", " Denmark", " and Iceland"]
+console.log(countries.split(", ")); // Dikkat edin burayada. ', ' virgül ve boşluk bulunmakta bu yüzden elementleri virgülden ayırıp boşluklsuz arrray oluşturuyor. ["Finland", "Sweden", "Norway", "Denmark", "and Iceland"]
```
-8. *trim()*: String'in başında ve sonundaki boşlukları silmeye yarar.
+8. _trim()_: String'in başında ve sonundaki boşlukları silmeye yarar.
```js
-let string = ' 30 Days Of JavaScript '
+let string = " 30 Days Of JavaScript ";
-console.log(string)
-console.log(string.trim(' '))
+console.log(string);
+console.log(string.trim(" "));
-let firstName = ' Asabeneh '
+let firstName = " Asabeneh ";
-console.log(firstName)
-console.log(firstName.trim()) // içinde tırnak kullanmasanız dahi boşlukları siler
+console.log(firstName);
+console.log(firstName.trim()); // içinde tırnak kullanmasanız dahi boşlukları siler
```
```sh
- 30 Days Of JavasCript
+ 30 Days Of JavasCript
30 Days Of JavasCript
- Asabeneh
+ Asabeneh
Asabeneh
```
-9. *includes()*: Bu metot string içerisinde varlık kontrolü yapmaya yarar. Eğer bulursa true, bulamazsa false döner. ( birebir arama yapar )
+9. _includes()_: Bu metot string içerisinde varlık kontrolü yapmaya yarar. Eğer bulursa true, bulamazsa false döner. ( birebir arama yapar )
```js
-let string = '30 Days Of JavaScript'
+let string = "30 Days Of JavaScript";
-console.log(string.includes('Days')) // true
-console.log(string.includes('days')) // false - birebir arama yapar!
-console.log(string.includes('Script')) // true
-console.log(string.includes('script')) // false
-console.log(string.includes('java')) // false
-console.log(string.includes('Java')) // true
+console.log(string.includes("Days")); // true
+console.log(string.includes("days")); // false - birebir arama yapar!
+console.log(string.includes("Script")); // true
+console.log(string.includes("script")); // false
+console.log(string.includes("java")); // false
+console.log(string.includes("Java")); // true
-let country = 'Finland'
+let country = "Finland";
-console.log(country.includes('fin')) // false
-console.log(country.includes('Fin')) // true
-console.log(country.includes('land')) // true
-console.log(country.includes('Land')) // false
+console.log(country.includes("fin")); // false
+console.log(country.includes("Fin")); // true
+console.log(country.includes("land")); // true
+console.log(country.includes("Land")); // false
```
-10. *replace()*: Bu metot string içerisinde değiştirme yapmamızı sağlar. Eski ve Yeni olmak üzere iki argüman alır.
+10. _replace()_: Bu metot string içerisinde değiştirme işlemi yapmamızı sağlar. Eski ve Yeni olmak üzere iki argüman alır.
```js
-string.replace(oldsubstring, newsubstring)
+string.replace(oldsubstring, newsubstring);
```
```js
-let string = '30 Days Of JavaScript'
-console.log(string.replace('JavaScript', 'Python')) // 30 Days Of Python
+let string = "30 Days Of JavaScript";
+console.log(string.replace("JavaScript", "Python")); // 30 Days Of Python
-let country = 'Finland'
-console.log(country.replace('Fin', 'Noman')) // Nomanland
+let country = "Finland";
+console.log(country.replace("Fin", "Noman")); // Nomanland
```
-11. *charAt()*: Stringdeki indeksi belirttiğinizde o indeksin değerini yazdırır.
+11. _charAt()_: Stringdeki indeksi belirttiğinizde o indeksin değerini döndürür.
```js
-string.charAt(index)
+string.charAt(index);
```
```js
-let string = '30 Days Of JavaScript'
-console.log(string.charAt(0)) // 3 (0. indeksin değerini döndürdü)
+let string = "30 Days Of JavaScript";
+console.log(string.charAt(0)); // 3 (0. indeksin değerini döndürdü)
-let lastIndex = string.length - 1 // bu kısımda yukardaki değişkenin karakter sayısını alıyor (21) sonra bu sonucu 1 ile çıkartıyor sonuç 20. aşağı bak
-console.log(string.charAt(lastIndex)) // pogramlamada sayma 0 dan başladığı için -1 yapıyor yukarıda console.log da çıkan sonuç "t" olacaktır. Buda 20. karakterdir. İnanmazsan say =) ama sıfırdan başlamayı unutma
+let lastIndex = string.length - 1; // bu kısımda yukardaki değişkenin karakter sayısını alıyor (21) sonra bu sonucu 1 ile çıkartıyor sonuç 20. aşağı bak
+console.log(string.charAt(lastIndex)); // pogramlamada sayma 0 dan başladığı için -1 yapıyor yukarıda console.log da çıkan sonuç "t" olacaktır. Buda 20. karakterdir. İnanmazsan say =) ama sıfırdan başlamayı unutma
```
-12. *charCodeAt()*: String'teki vermiş olduğunuz index değerinin ASCII numarasını döndürür.
+12. _charCodeAt()_: String'teki vermiş olduğunuz index değerinin ASCII numarasını döndürür.
```js
-string.charCodeAt(index)
+string.charCodeAt(index);
```
```js
-let string = '30 Days Of JavaScript'
-console.log(string.charCodeAt(3)) // D ASCII 68
-
-let lastIndex = string.length - 1
-console.log(string.charCodeAt(lastIndex)) // t ASCII 116
+let string = "30 Days Of JavaScript";
+console.log(string.charCodeAt(3)); // D ASCII kodu 68
+let lastIndex = string.length - 1;
+console.log(string.charCodeAt(lastIndex)); // t ASCII kodu 116
```
-13. *indexOf()*: Bu metot belirtilen değerin indeksini verir. Değer bulunamazsa -1 sonucunu döndürür. ( Birebir arama yapar örneğe bakın )
+13. _indexOf()_: Bu metot belirtilen değerin indeksini verir. Değer bulunamazsa -1 sonucunu döndürür. ( Birebir arama yapar örneğe bakın )
```js
-string.indexOf(substring)
+string.indexOf(substring);
```
```js
-let string = '30 Days Of JavaScript'
+let string = "30 Days Of JavaScript";
-console.log(string.indexOf('D')) // 3
-console.log(string.indexOf('Days')) // 3
-console.log(string.indexOf('days')) // -1
-console.log(string.indexOf('a')) // 4
-console.log(string.indexOf('JavaScript')) // 11
-console.log(string.indexOf('Script')) //15
-console.log(string.indexOf('script')) // -1
+console.log(string.indexOf("D")); // 3
+console.log(string.indexOf("Days")); // 3
+console.log(string.indexOf("days")); // -1
+console.log(string.indexOf("a")); // 4
+console.log(string.indexOf("JavaScript")); // 11
+console.log(string.indexOf("Script")); //15
+console.log(string.indexOf("script")); // -1
```
-14. *lastIndexOf()*: Bu metot belirtilen değerin son değer indeksini verir. Değer bulunamazsa -1 sonucunu döndürür. ( Birebir arama yapar örneğe bakın )
-
+14. _lastIndexOf()_: Bu metot belirtilen değerin son değer indeksini verir. Değer bulunamazsa -1 sonucunu döndürür. ( Birebir arama yapar örneğe bakın )
```js
//syntax
-string.lastIndexOf(substring)
+string.lastIndexOf(substring);
```
```js
-let string = 'I love JavaScript. If you do not love JavaScript what else can you love.'
+let string =
+ "I love JavaScript. If you do not love JavaScript what else can you love.";
-console.log(string.lastIndexOf('love')) // 67
-console.log(string.lastIndexOf('you')) // 63
-console.log(string.lastIndexOf('JavaScript')) // 38
+console.log(string.lastIndexOf("love")); // 67
+console.log(string.lastIndexOf("you")); // 63
+console.log(string.lastIndexOf("JavaScript")); // 38
```
-15. *concat()*: Bu metot birleştirme işlemini sağlar, birden fazla değer alabilir
+15. _concat()_: Bu metot birleştirme işlemini sağlar, birden fazla değer alabilir
```js
-string.concat(substring, substring, substring)
+string.concat(substring, substring, substring);
```
```js
-let string = '30'
-console.log(string.concat("Days", "Of", "JavaScript")) // 30DaysOfJavaScript
+let string = "30";
+console.log(string.concat("Days", "Of", "JavaScript")); // 30DaysOfJavaScript
-let country = 'Fin'
-console.log(country.concat("land")) // Finland
+let country = "Fin";
+console.log(country.concat("land")); // Finland
```
-16. *startsWith*: String'in belirtilen değer ile başlayıp başlamadığını kontrol eder. true yada false döndürür.
+16. _startsWith_: String'in belirtilen değer ile başlayıp başlamadığını kontrol eder. true ya da false döndürür.
```js
//syntax
-string.startsWith(substring)
+string.startsWith(substring);
```
```js
-let string = 'Love is the best to in this world'
+let string = "Love is the best to in this world";
-console.log(string.startsWith('Love')) // true
-console.log(string.startsWith('love')) // false
-console.log(string.startsWith('world')) // false
+console.log(string.startsWith("Love")); // true
+console.log(string.startsWith("love")); // false
+console.log(string.startsWith("world")); // false
-let country = 'Finland'
+let country = "Finland";
-console.log(country.startsWith('Fin')) // true
-console.log(country.startsWith('fin')) // false
-console.log(country.startsWith('land')) // false
+console.log(country.startsWith("Fin")); // true
+console.log(country.startsWith("fin")); // false
+console.log(country.startsWith("land")); // false
```
-17. *endsWith*: String'in belirtilen değer ile bitip bitmediğini kontrol eder. true yada false döndürür.
+17. _endsWith_: String'in belirtilen değer ile bitip bitmediğini kontrol eder. true ya da false döndürür.
```js
-string.endsWith(substring)
+string.endsWith(substring);
```
```js
-let string = 'Love is the most powerful feeling in the world'
+let string = "Love is the most powerful feeling in the world";
-console.log(string.endsWith('world')) // true
-console.log(string.endsWith('love')) // false
-console.log(string.endsWith('in the world')) // true
+console.log(string.endsWith("world")); // true
+console.log(string.endsWith("love")); // false
+console.log(string.endsWith("in the world")); // true
-let country = 'Finland'
+let country = "Finland";
-console.log(country.endsWith('land')) // true
-console.log(country.endsWith('fin')) // false
-console.log(country.endsWith('Fin')) // false
+console.log(country.endsWith("land")); // true
+console.log(country.endsWith("fin")); // false
+console.log(country.endsWith("Fin")); // false
```
-18. *search*: Argüman olarak bir alt dize alır ve ilk eşleşmenin dizinini döndürür. Arama değeri bir dize veya normal ifade kalıbı olabilir.
+18. _search_: Argüman olarak bir alt dize alır ve ilk eşleşmenin dizinini döndürür. Arama değeri bir dize veya normal ifade kalıbı olabilir.
```js
-string.search(substring)
+string.search(substring);
```
```js
-let string = 'I love JavaScript. If you do not love JavaScript what else can you love.'
-console.log(string.search('love')) // 2
-console.log(string.search(/javascript/gi)) // 7 buradaki gi açıklaması bir alt örnekte var
+let string =
+ "I love JavaScript. If you do not love JavaScript what else can you love.";
+console.log(string.search("love")); // 2
+console.log(string.search(/javascript/gi)); // 7 buradaki gi açıklaması bir alt örnekte var
```
-19. *match*: Argüman olarak bir alt dize veya normal ifade kalıbı alır ve eşleşme varsa bir dizi döndürür, değilse null döndürür. Normal bir ifade kalıbının nasıl göründüğünü görelim. / işareti ile başlar ve / işareti ile biter.
+19. _match_: Argüman olarak bir alt dize veya normal ifade kalıbı alır ve eşleşme varsa bir dizi döndürür, değilse null döndürür. Normal bir ifade kalıbının nasıl göründüğünü görelim. / işareti ile başlar ve / işareti ile biter.
```js
-let string = 'love'
-let patternOne = /love/ // koşulsuz
-let patternTwo = /love/gi // g-bütün metinde ara, i - büyük küçük harf duyarsız
+let string = "love";
+let patternOne = /love/; // koşulsuz
+let patternTwo = /love/gi; // g-bütün metinde ara, i - büyük küçük harf duyarsız
```
Match syntax
```js
// syntax
-string.match(substring)
+string.match(substring);
```
```js
-let string = 'I love JavaScript. If you do not love JavaScript what else can you love.'
-console.log(string.match('love'))
+let string =
+ "I love JavaScript. If you do not love JavaScript what else can you love.";
+console.log(string.match("love"));
```
```sh
@@ -771,33 +773,34 @@ console.log(string.match('love'))
```
```js
-let pattern = /love/gi
-console.log(string.match(pattern)) // ["love", "love", "love"]
+let pattern = /love/gi;
+console.log(string.match(pattern)); // ["love", "love", "love"]
```
Normal bir ifade kullanarak metinden sayıları çıkaralım. Burası normal ifade bölümü değil, panik yapmayın! Düzenli ifadeleri daha sonra ele alacağız.
```js
-let txt = 'In 2019, I ran 30 Days of Python. Now, in 2020 I am super exited to start this challenge'
-let regEx = /\d+/
+let txt =
+ "In 2019, I ran 30 Days of Python. Now, in 2020 I am super exited to start this challenge";
+let regEx = /\d+/;
// kaçış karakterli d, d'nin normal olmadığı anlamına gelir, d bunun yerine bir rakam gibi davranır
// + bir veya daha fazla basamaklı sayı anlamına gelir,
// ondan sonra g varsa global demektir, her yerde ara.
-console.log(txt.match(regEx)) // ["2", "0", "1", "9", "3", "0", "2", "0", "2", "0"]
-console.log(txt.match(/\d+/g)) // ["2019", "30", "2020"]
+console.log(txt.match(regEx)); // ["2", "0", "1", "9", "3", "0", "2", "0", "2", "0"]
+console.log(txt.match(/\d+/g)); // ["2019", "30", "2020"]
```
-20. *repeat()*: bağımsız değişken olarak bir sayı alır ve stringi sayı kadar döndürür.
+20. _repeat()_: bağımsız değişken olarak bir sayı alır ve stringi sayı kadar döndürür.
```js
-string.repeat(n)
+string.repeat(n);
```
```js
-let string = 'love'
-console.log(string.repeat(10)) // lovelovelovelovelovelovelovelovelovelove
+let string = "love";
+console.log(string.repeat(10)); // lovelovelovelovelovelovelovelovelovelove
```
## Veri Türlerini Kontrol Etme ve Döküm
@@ -812,33 +815,32 @@ Belirli bir değişkenin veri türünü kontrol etmek için _typeof_ yöntemini
// Farklı javascript veri türleri
// Farklı veri tipleri tanımlayalım
-let firstName = 'Asabeneh' // string
-let lastName = 'Yetayeh' // string
-let country = 'Finland' // string
-let city = 'Helsinki' // string
-let age = 250 // number, benim gerçek yaşım değil merak etme
-let job // undefined, çünkü bir değer atanmamış
-
-console.log(typeof 'Asabeneh') // string
-console.log(typeof firstName) // string
-console.log(typeof 10) // number
-console.log(typeof 3.14) // number
-console.log(typeof true) // boolean
-console.log(typeof false) // boolean
-console.log(typeof NaN) // number
-console.log(typeof job) // undefined
-console.log(typeof undefined) // undefined
-console.log(typeof null) // object
+let firstName = "Asabeneh"; // string
+let lastName = "Yetayeh"; // string
+let country = "Finland"; // string
+let city = "Helsinki"; // string
+let age = 250; // number, benim gerçek yaşım değil merak etme
+let job; // undefined, çünkü bir değer atanmamış
+
+console.log(typeof "Asabeneh"); // string
+console.log(typeof firstName); // string
+console.log(typeof 10); // number
+console.log(typeof 3.14); // number
+console.log(typeof true); // boolean
+console.log(typeof false); // boolean
+console.log(typeof NaN); // number
+console.log(typeof job); // undefined
+console.log(typeof undefined); // undefined
+console.log(typeof null); // object
```
### Veri Türünü Değiştirme (Döküm)
- Döküm: Bir veri tipini başka bir veri tipine dönüştürme. Kullandıklarımız _parseInt()_, _parseFloat()_, _Number()_, _+ sign_, _str()_
- Aritmetik işlemler yapmadan önce string sayıları önce integer yada float türüne dönüştürmeliyiz yoksa hata alırız.
+ Aritmetik işlemler yapmadan önce string sayıları önce integer ya da float türüne dönüştürmeliyiz yoksa hata alırız.
#### String to Int
-
String bir numarayı sayıya dönüştürebiliriz. Alıntı içerisindeki herhangi bir sayı string numarasıdır. Bir string numarası örneği: '10', '5', vb.
Aşağıdaki metotları kullanarak string'i sayıya dönüştürebiliriz:
@@ -847,28 +849,28 @@ Aşağıdaki metotları kullanarak string'i sayıya dönüştürebiliriz:
- Plus sign(+) // artı işareti demek
```js
-let num = '10'
-let numInt = parseInt(num)
-console.log(numInt) // 10
+let num = "10";
+let numInt = parseInt(num);
+console.log(numInt); // 10
```
```js
-let num = '10'
-let numInt = Number(num)
+let num = "10";
+let numInt = Number(num);
-console.log(numInt) // 10
+console.log(numInt); // 10
```
```js
-let num = '10'
-let numInt = +num
+let num = "10";
+let numInt = +num;
-console.log(numInt) // 10
+console.log(numInt); // 10
```
#### String to Float
-String içindeki ondalık numarayı sayıya çevirebiliriz. Tırnak içerisindeki ondalık sayı string ondalık sayıdır. Bir string ondalık numarası örneği: '9.81', '3.14', '1.44' vb.
+String içindeki ondalık numarayı sayıya çevirebiliriz. Tırnak içerisindeki ondalık sayı string ondalık sayıdır. Bir string ondalık numarası örneği: '9.81', '3.14', '1.44' vb.
Aşağıdaki metotları kullanarak ondalık stringi sayıya dönüştürebiliriz:
- parseFloat()
@@ -876,24 +878,24 @@ Aşağıdaki metotları kullanarak ondalık stringi sayıya dönüştürebiliriz
- Plus sign(+)
```js
-let num = '9.81'
-let numFloat = parseFloat(num)
+let num = "9.81";
+let numFloat = parseFloat(num);
-console.log(numFloat) // 9.81
+console.log(numFloat); // 9.81
```
```js
-let num = '9.81'
-let numFloat = Number(num)
+let num = "9.81";
+let numFloat = Number(num);
-console.log(numFloat) // 9.81
+console.log(numFloat); // 9.81
```
```js
-let num = '9.81'
-let numFloat = +num
+let num = "9.81";
+let numFloat = +num;
-console.log(numFloat) // 9.81
+console.log(numFloat); // 9.81
```
#### Float to Int
@@ -902,63 +904,62 @@ Ondalık sayıları tam sayılara çevirebiliriz. (Int) ( bu aşağıya yuvarlı
Float'ı int'e dönüştürmek için aşağıdaki metodu kullanıyoruz:
- parseInt()
-
+
```js
-let num = 9.81
-let numInt = parseInt(num)
+let num = 9.81;
+let numInt = parseInt(num);
-console.log(numInt) // 9
+console.log(numInt); // 9
```
-🌕 Harikasın. 2. gün zorluklarını yeni tamamladınız ve mükemmelliğe giden yolda iki adım öndesiniz. Şimdi beyniniz ve kasınız için bazı egzersizler yapın.
+🌕 Harikasın. 2. gün zorluklarını yeni tamamladınız ve mükemmelliğe giden yolda iki adım öndesiniz. Şimdi beyniniz ve kasınız için bazı egzersizler yapın.
## 💻 Gün 2: Egzersizleri
### Exercise: Seviye 1
-1. Challenge adında bir değişken tanımlayın ve **'30 Days Of JavaScript'** başlangıç değerine atayın.
-2. __console.log()__ kullanarak tarayıcı konsolunda değişkeni yazdırın,
-3. _console.log()_ kullanarak tarayıcı konsolunda dizenin __length__ değerini yazdırın,
-4. __toUpperCase()__ yöntemini kullanarak tüm dize karakterlerini büyük harflerle değiştirin,
-5. __toLowerCase()__ yöntemini kullanarak tüm dize karakterlerini küçük harflerle değiştirin,
-6. __substr()__ veya __substring()__ yöntemini kullanarak string'in ilk kelimesini kesin-silin (dilimleyin)
-7. *Days Of JavaScript* ifadesini *30 Days Of JavaScript*'ten ayırın.
-8. __includes()__ yöntemini kullanarak string'in __Script__ kelimesini içerip içermediğini kontrol edin
-9. __split()__ yöntemini kullanarak __string__ öğesini bir __array__'ye bölün
-10. 30 Days Of JavaScript dizesini __split()__ yöntemini kullanarak boşlukta bölün
-11. 'Facebook, Google, Microsoft, Apple, IBM, Oracle, Amazon' dizeyi virgülden __split__ ve bir dizi olarak değiştirin.
-12. __replace()__ yöntemini kullanarak 30 Days of JavaScript'i 30 Days of Python olarak değiştirin.
-13. 'JavaScript'in 30 Günü' dizesinde dizin 15'teki karakter nedir? __charAt()__ yöntemini kullanın.
-14. __charCodeAt()__ kullanan 'JavaScript'in 30 Günü' dizesindeki J karakter kodu nedir?
-15. 30 Days of JavaScript'te __a__ öğesinin ilk oluşumunun konumunu belirlemek için __indexOf__ kullanın
-16. 30 Days of JavaScript'te __a__ öğesinin son oluşumunun konumunu belirlemek için __lastIndexOf__ kullanın.
-17. Aşağıdaki cümlede __çünkü__ kelimesinin ilk geçtiği yeri bulmak için __indexOf__ kullanın:
-__'Bir cümleyi çünkü ile bitiremezsiniz çünkü çünkü bir bağlaçtır'__
-18. Aşağıdaki cümlede __çünkü__ kelimesinin son geçtiği yeri bulmak için __lastIndexOf__ kullanın:
-__'Bir cümleyi çünkü ile bitiremezsiniz çünkü çünkü bir bağlaçtır'__
-19. Aşağıdaki cümlede __çünkü__ kelimesinin ilk geçtiği yeri bulmak için __search__ kullanın:
-__'Bir cümleyi çünkü ile bitiremezsiniz çünkü çünkü bir bağlaçtır'__
-20. Bir dizgenin başındaki ve sonundaki boşlukları kaldırmak için __trim()__ kullanın. Örneğin '30 Days Of JavaScript'.
-21. *30 Days Of JavaScript* dizesiyle __startsWith()__ yöntemini kullanın ve sonucu doğru yapın
-22. *30 Days Of JavaScript* dizesiyle __endsWith()__ yöntemini kullanın ve sonucu doğru yapın
-23. JavaScript'in 30 Günü'ndeki tüm __a__'leri bulmak için __match()__ yöntemini kullanın
-24. __concat()__ kullanın ve '30 Days of' ve 'JavaScript'i tek bir dize olan '30 Days of JavaScript' ile birleştirin
-25. 30 Gün JavaScript'i 2 kez yazdırmak için __repeat()__ yöntemini kullanın
-
+1. Challenge adında bir değişken tanımlayın ve **'30 Days Of JavaScript'** başlangıç değerine atayın.
+2. **console.log()** kullanarak tarayıcı konsolunda değişkeni yazdırın,
+3. _console.log()_ kullanarak tarayıcı konsolunda dizenin **length** değerini yazdırın,
+4. **toUpperCase()** yöntemini kullanarak tüm dize karakterlerini büyük harflerle değiştirin,
+5. **toLowerCase()** yöntemini kullanarak tüm dize karakterlerini küçük harflerle değiştirin,
+6. **substr()** veya **substring()** yöntemini kullanarak string'in ilk kelimesini kesin-silin (dilimleyin)
+7. _Days Of JavaScript_ ifadesini _30 Days Of JavaScript_'ten ayırın.
+8. **includes()** yöntemini kullanarak string'in **Script** kelimesini içerip içermediğini kontrol edin
+9. **split()** yöntemini kullanarak **string** öğesini bir **diziye**'ye bölün
+10. 30 Days Of JavaScript dizesini **split()** yöntemini kullanarak boşlukta bölün
+11. 'Facebook, Google, Microsoft, Apple, IBM, Oracle, Amazon' dizeyi virgülden **split** ve bir dizi olarak değiştirin.
+12. **replace()** yöntemini kullanarak 30 Days of JavaScript'i 30 Days of Python olarak değiştirin.
+13. 'JavaScript'in 30 Günü' dizesinde dizin 15'teki karakter nedir? **charAt()** yöntemini kullanın.
+14. **charCodeAt()** kullanan 'JavaScript'in 30 Günü' dizesindeki J karakter kodu nedir?
+15. 30 Days of JavaScript'te **a** öğesinin ilk oluşumunun konumunu belirlemek için **indexOf** kullanın
+16. 30 Days of JavaScript'te **a** öğesinin son oluşumunun konumunu belirlemek için **lastIndexOf** kullanın.
+17. Aşağıdaki cümlede **çünkü** kelimesinin ilk geçtiği yeri bulmak için **indexOf** kullanın:
+ **'Bir cümleyi çünkü ile bitiremezsiniz çünkü çünkü bir bağlaçtır'**
+18. Aşağıdaki cümlede **çünkü** kelimesinin son geçtiği yeri bulmak için **lastIndexOf** kullanın:
+ **'Bir cümleyi çünkü ile bitiremezsiniz çünkü çünkü bir bağlaçtır'**
+19. Aşağıdaki cümlede **çünkü** kelimesinin ilk geçtiği yeri bulmak için **search** kullanın:
+ **'Bir cümleyi çünkü ile bitiremezsiniz çünkü çünkü bir bağlaçtır'**
+20. Bir dizgenin başındaki ve sonundaki boşlukları kaldırmak için **trim()** kullanın. Örneğin '30 Days Of JavaScript'.
+21. _30 Days Of JavaScript_ dizesiyle **startsWith()** yöntemini kullanın ve sonucu doğru yapın
+22. _30 Days Of JavaScript_ dizesiyle **endsWith()** yöntemini kullanın ve sonucu doğru yapın
+23. JavaScript'in 30 Günü'ndeki tüm **a**'leri bulmak için **match()** yöntemini kullanın
+24. **concat()** kullanın ve '30 Days of' ve 'JavaScript'i tek bir dize olan '30 Days of JavaScript' ile birleştirin
+25. 30 Gün JavaScript'i 2 kez yazdırmak için **repeat()** yöntemini kullanın
### Egzersiz: Seviye 2
1. console.log() kullanarak aşağıdaki ifadeyi yazdırın:
- ```sh
- The quote 'There is no exercise better for the heart than reaching down and lifting people up.' by John Holmes teaches us to help one another.
- ```
+ ```sh
+ The quote 'There is no exercise better for the heart than reaching down and lifting people up.' by John Holmes teaches us to help one another.
+ ```
2. console.log()'u kullanarak Rahibe Teresa'nın aşağıdaki alıntısını yazdırın:
- ```sh
- "Love is not patronizing and charity isn't about pity, it is about love. Charity and love are the same -- with charity you give love, so don't just give money but reach out your hand instead."
- ```
+ ```sh
+ "Love is not patronizing and charity isn't about pity, it is about love. Charity and love are the same -- with charity you give love, so don't just give money but reach out your hand instead."
+ ```
3. '10' tipinin tam olarak 10'a eşit olup olmadığını kontrol edin. Değilse tam olarak eşit yapın.
4. parseFloat('9.8') 10'a tam olarak eşit değilse, 10'a eşit olup olmadığını kontrol edin.
@@ -978,19 +979,20 @@ __'Bir cümleyi çünkü ile bitiremezsiniz çünkü çünkü bir bağlaçtır'_
5 1 5 25 125
```
-12. __substr__ kullanarak __çünkü çünkü__ ifadesini aşağıdaki cümleden ayırın:__'Bir cümleyi çünkü ile bitiremezsiniz çünkü çünkü bir bağlaçtır'__
+12. **substr** kullanarak **çünkü çünkü** ifadesini aşağıdaki cümleden ayırın:**'Bir cümleyi çünkü ile bitiremezsiniz çünkü çünkü bir bağlaçtır'**
### Egzersiz: Seviye 3
-1. 'Aşk bu dünyadaki en iyi şeydir. Bazıları aşkını buldu ve bazıları hala aşkını arıyor.' Bu cümledeki __love__ kelimesini sayın.
-2. Aşağıdaki cümledeki tüm __çünkü__ sayısını saymak için __match()__ kullanın:__'Bir cümleyi çünkü ile bitiremezsiniz çünkü çünkü bir bağlaçtır'__
+1. 'Aşk bu dünyadaki en iyi şeydir. Bazıları aşkını buldu ve bazıları hala aşkını arıyor.' Bu cümledeki **love** kelimesini sayın.
+2. Aşağıdaki cümledeki tüm **çünkü** sayısını saymak için **match()** kullanın:**'Bir cümleyi çünkü ile bitiremezsiniz çünkü çünkü bir bağlaçtır'**
3. Aşağıdaki metni temizleyin ve en sık kullanılan kelimeyi bulun (ipucu, değiştirme ve normal ifadeleri kullanın).
- ```js
- const sentence = '%I $am@% a %tea@cher%, &and& I lo%#ve %te@a@ching%;. The@re $is no@th@ing; &as& mo@re rewarding as educa@ting &and& @emp%o@weri@ng peo@ple. ;I found tea@ching m%o@re interesting tha@n any ot#her %jo@bs. %Do@es thi%s mo@tiv#ate yo@u to be a tea@cher!? %Th#is 30#Days&OfJavaScript &is al@so $the $resu@lt of &love& of tea&ching'
- ```
+ ```js
+ const sentence =
+ "%I $am@% a %tea@cher%, &and& I lo%#ve %te@a@ching%;. The@re $is no@th@ing; &as& mo@re rewarding as educa@ting &and& @emp%o@weri@ng peo@ple. ;I found tea@ching m%o@re interesting tha@n any ot#her %jo@bs. %Do@es thi%s mo@tiv#ate yo@u to be a tea@cher!? %Th#is 30#Days&OfJavaScript &is al@so $the $resu@lt of &love& of tea&ching";
+ ```
-4. Aşağıdaki metinden sayıları çıkararak kişinin yıllık toplam gelirini hesaplayın.
+4. Aşağıdaki metinden sayıları çıkararak kişinin yıllık toplam gelirini hesaplayın.
'Aylık maaşından 5000 euro, yıllık 10000 euro ikramiye, ayda 15000 euro online kurstan kazanıyor.'
From 1f9ddf6d20b1a01c249769ee8d4cd62b85ad8214 Mon Sep 17 00:00:00 2001
From: aliwert <154356044+aliwert@users.noreply.github.com>
Date: Thu, 3 Oct 2024 23:42:58 +0300
Subject: [PATCH 2/3] typos & remove duplicate words
---
.../03_booleans_operators_date.md | 391 +++++++--------
.../03_booleans_operators_date.md | 446 +++++++++---------
2 files changed, 418 insertions(+), 419 deletions(-)
diff --git a/03_Day_Booleans_operators_date/03_booleans_operators_date.md b/03_Day_Booleans_operators_date/03_booleans_operators_date.md
index bb376ae..4941d8f 100644
--- a/03_Day_Booleans_operators_date/03_booleans_operators_date.md
+++ b/03_Day_Booleans_operators_date/03_booleans_operators_date.md
@@ -7,10 +7,11 @@
- Author:
- Asabeneh Yetayeh
- January, 2020
-
+Author:
+Asabeneh Yetayeh
+ January, 2020
+
+
[<< Day 2](../02_Day_Data_types/02_day_data_types.md) | [Day 4 >>](../04_Day_Conditionals/04_day_conditionals.md)
@@ -18,38 +19,38 @@

- [📔 Day 3](#-day-3)
- - [Booleans](#booleans)
- - [Truthy values](#truthy-values)
- - [Falsy values](#falsy-values)
- - [Undefined](#undefined)
- - [Null](#null)
- - [Operators](#operators)
- - [Assignment operators](#assignment-operators)
- - [Arithmetic Operators](#arithmetic-operators)
- - [Comparison Operators](#comparison-operators)
- - [Logical Operators](#logical-operators)
- - [Increment Operator](#increment-operator)
- - [Decrement Operator](#decrement-operator)
- - [Ternary Operators](#ternary-operators)
- - [Operator Precedence](#operator-precedence)
- - [Window Methods](#window-methods)
- - [Window alert() method](#window-alert-method)
- - [Window prompt() method](#window-prompt-method)
- - [Window confirm() method](#window-confirm-method)
- - [Date Object](#date-object)
- - [Creating a time object](#creating-a-time-object)
- - [Getting full year](#getting-full-year)
- - [Getting month](#getting-month)
- - [Getting date](#getting-date)
- - [Getting day](#getting-day)
- - [Getting hours](#getting-hours)
- - [Getting minutes](#getting-minutes)
- - [Getting seconds](#getting-seconds)
- - [Getting time](#getting-time)
- - [💻 Day 3: Exercises](#-day-3-exercises)
- - [Exercises: Level 1](#exercises-level-1)
- - [Exercises: Level 2](#exercises-level-2)
- - [Exercises: Level 3](#exercises-level-3)
+ - [Booleans](#booleans)
+ - [Truthy values](#truthy-values)
+ - [Falsy values](#falsy-values)
+ - [Undefined](#undefined)
+ - [Null](#null)
+ - [Operators](#operators)
+ - [Assignment operators](#assignment-operators)
+ - [Arithmetic Operators](#arithmetic-operators)
+ - [Comparison Operators](#comparison-operators)
+ - [Logical Operators](#logical-operators)
+ - [Increment Operator](#increment-operator)
+ - [Decrement Operator](#decrement-operator)
+ - [Ternary Operators](#ternary-operators)
+ - [Operator Precedence](#operator-precedence)
+ - [Window Methods](#window-methods)
+ - [Window alert() method](#window-alert-method)
+ - [Window prompt() method](#window-prompt-method)
+ - [Window confirm() method](#window-confirm-method)
+ - [Date Object](#date-object)
+ - [Creating a time object](#creating-a-time-object)
+ - [Getting full year](#getting-full-year)
+ - [Getting month](#getting-month)
+ - [Getting date](#getting-date)
+ - [Getting day](#getting-day)
+ - [Getting hours](#getting-hours)
+ - [Getting minutes](#getting-minutes)
+ - [Getting seconds](#getting-seconds)
+ - [Getting time](#getting-time)
+ - [💻 Day 3: Exercises](#-day-3-exercises)
+ - [Exercises: Level 1](#exercises-level-1)
+ - [Exercises: Level 2](#exercises-level-2)
+ - [Exercises: Level 3](#exercises-level-3)
# 📔 Day 3
@@ -60,12 +61,12 @@ A boolean data type represents one of the two values:_true_ or _false_. Boolean
**Example: Boolean Values**
```js
-let isLightOn = true
-let isRaining = false
-let isHungry = false
-let isMarried = true
-let truValue = 4 > 3 // true
-let falseValue = 4 < 3 // false
+let isLightOn = true;
+let isRaining = false;
+let isHungry = false;
+let isMarried = true;
+let truValue = 4 > 3; // true
+let falseValue = 4 < 3; // false
```
We agreed that boolean values are either true or false.
@@ -93,15 +94,15 @@ It is good to remember those truthy values and falsy values. In later section, w
If we declare a variable and if we do not assign a value, the value will be undefined. In addition to this, if a function is not returning the value, it will be undefined.
```js
-let firstName
-console.log(firstName) //not defined, because it is not assigned to a value yet
+let firstName;
+console.log(firstName); //not defined, because it is not assigned to a value yet
```
## Null
```js
-let empty = null
-console.log(empty) // -> null , means no value
+let empty = null;
+console.log(empty); // -> null , means no value
```
## Operators
@@ -111,8 +112,8 @@ console.log(empty) // -> null , means no value
An equal sign in JavaScript is an assignment operator. It uses to assign a variable.
```js
-let firstName = 'Asabeneh'
-let country = 'Finland'
+let firstName = "Asabeneh";
+let country = "Finland";
```
Assignment Operators
@@ -125,44 +126,41 @@ Arithmetic operators are mathematical operators.
- Addition(+): a + b
- Subtraction(-): a - b
-- Multiplication(*): a * b
+- Multiplication(_): a _ b
- Division(/): a / b
- Modulus(%): a % b
- Exponential(**): a ** b
```js
-let numOne = 4
-let numTwo = 3
-let sum = numOne + numTwo
-let diff = numOne - numTwo
-let mult = numOne * numTwo
-let div = numOne / numTwo
-let remainder = numOne % numTwo
-let powerOf = numOne ** numTwo
-
-console.log(sum, diff, mult, div, remainder, powerOf) // 7,1,12,1.33,1, 64
+let numOne = 4;
+let numTwo = 3;
+let sum = numOne + numTwo;
+let diff = numOne - numTwo;
+let mult = numOne * numTwo;
+let div = numOne / numTwo;
+let remainder = numOne % numTwo;
+let powerOf = numOne ** numTwo;
+console.log(sum, diff, mult, div, remainder, powerOf); // 7,1,12,1.33,1, 64
```
```js
-const PI = 3.14
-let radius = 100 // length in meter
+const PI = 3.14;
+let radius = 100; // length in meter
//Let us calculate area of a circle
-const areaOfCircle = PI * radius * radius
-console.log(areaOfCircle) // 314 m
+const areaOfCircle = PI * radius * radius;
+console.log(areaOfCircle); // 314 m
-
-const gravity = 9.81 // in m/s2
-let mass = 72 // in Kilogram
+const gravity = 9.81; // in m/s2
+let mass = 72; // in Kilogram
// Let us calculate weight of an object
-const weight = mass * gravity
-console.log(weight) // 706.32 N(Newton)
-
-const boilingPoint = 100 // temperature in oC, boiling point of water
-const bodyTemp = 37 // body temperature in oC
+const weight = mass * gravity;
+console.log(weight); // 706.32 N(Newton)
+const boilingPoint = 100; // temperature in oC, boiling point of water
+const bodyTemp = 37; // body temperature in oC
// Concatenating string with numbers using string interpolation
/*
@@ -172,7 +170,7 @@ const bodyTemp = 37 // body temperature in oC
*/
console.log(
`The boiling point of water is ${boilingPoint} oC.\nHuman body temperature is ${bodyTemp} oC.\nThe gravity of earth is ${gravity} m / s2.`
-)
+);
```
### Comparison Operators
@@ -183,38 +181,38 @@ In programming we compare values, we use comparison operators to compare two val
**Example: Comparison Operators**
```js
-console.log(3 > 2) // true, because 3 is greater than 2
-console.log(3 >= 2) // true, because 3 is greater than 2
-console.log(3 < 2) // false, because 3 is greater than 2
-console.log(2 < 3) // true, because 2 is less than 3
-console.log(2 <= 3) // true, because 2 is less than 3
-console.log(3 == 2) // false, because 3 is not equal to 2
-console.log(3 != 2) // true, because 3 is not equal to 2
-console.log(3 == '3') // true, compare only value
-console.log(3 === '3') // false, compare both value and data type
-console.log(3 !== '3') // true, compare both value and data type
-console.log(3 != 3) // false, compare only value
-console.log(3 !== 3) // false, compare both value and data type
-console.log(0 == false) // true, equivalent
-console.log(0 === false) // false, not exactly the same
-console.log(0 == '') // true, equivalent
-console.log(0 == ' ') // true, equivalent
-console.log(0 === '') // false, not exactly the same
-console.log(1 == true) // true, equivalent
-console.log(1 === true) // false, not exactly the same
-console.log(undefined == null) // true
-console.log(undefined === null) // false
-console.log(NaN == NaN) // false, not equal
-console.log(NaN === NaN) // false
-console.log(typeof NaN) // number
-
-console.log('mango'.length == 'avocado'.length) // false
-console.log('mango'.length != 'avocado'.length) // true
-console.log('mango'.length < 'avocado'.length) // true
-console.log('milk'.length == 'meat'.length) // true
-console.log('milk'.length != 'meat'.length) // false
-console.log('tomato'.length == 'potato'.length) // true
-console.log('python'.length > 'dragon'.length) // false
+console.log(3 > 2); // true, because 3 is greater than 2
+console.log(3 >= 2); // true, because 3 is greater than 2
+console.log(3 < 2); // false, because 3 is greater than 2
+console.log(2 < 3); // true, because 2 is less than 3
+console.log(2 <= 3); // true, because 2 is less than 3
+console.log(3 == 2); // false, because 3 is not equal to 2
+console.log(3 != 2); // true, because 3 is not equal to 2
+console.log(3 == "3"); // true, compare only value
+console.log(3 === "3"); // false, compare both value and data type
+console.log(3 !== "3"); // true, compare both value and data type
+console.log(3 != 3); // false, compare only value
+console.log(3 !== 3); // false, compare both value and data type
+console.log(0 == false); // true, equivalent
+console.log(0 === false); // false, not exactly the same
+console.log(0 == ""); // true, equivalent
+console.log(0 == " "); // true, equivalent
+console.log(0 === ""); // false, not exactly the same
+console.log(1 == true); // true, equivalent
+console.log(1 === true); // false, not exactly the same
+console.log(undefined == null); // true
+console.log(undefined === null); // false
+console.log(NaN == NaN); // false, not equal
+console.log(NaN === NaN); // false
+console.log(typeof NaN); // number
+
+console.log("mango".length == "avocado".length); // false
+console.log("mango".length != "avocado".length); // true
+console.log("mango".length < "avocado".length); // true
+console.log("milk".length == "meat".length); // true
+console.log("milk".length != "meat".length); // false
+console.log("tomato".length == "potato".length); // true
+console.log("python".length > "dragon".length); // false
```
Try to understand the above comparisons with some logic. Remembering without any logic might be difficult.
@@ -233,23 +231,23 @@ The ! operator negates true to false and false to true.
```js
// && ampersand operator example
-const check = 4 > 3 && 10 > 5 // true && true -> true
-const check = 4 > 3 && 10 < 5 // true && false -> false
-const check = 4 < 3 && 10 < 5 // false && false -> false
+const check = 4 > 3 && 10 > 5; // true && true -> true
+const check = 4 > 3 && 10 < 5; // true && false -> false
+const check = 4 < 3 && 10 < 5; // false && false -> false
// || pipe or operator, example
-const check = 4 > 3 || 10 > 5 // true || true -> true
-const check = 4 > 3 || 10 < 5 // true || false -> true
-const check = 4 < 3 || 10 < 5 // false || false -> false
+const check = 4 > 3 || 10 > 5; // true || true -> true
+const check = 4 > 3 || 10 < 5; // true || false -> true
+const check = 4 < 3 || 10 < 5; // false || false -> false
//! Negation examples
-let check = 4 > 3 // true
-let check = !(4 > 3) // false
-let isLightOn = true
-let isLightOff = !isLightOn // false
-let isMarried = !false // true
+let check = 4 > 3; // true
+let check = !(4 > 3); // false
+let isLightOn = true;
+let isLightOff = !isLightOn; // false
+let isMarried = !false; // true
```
### Increment Operator
@@ -259,17 +257,17 @@ In JavaScript we use the increment operator to increase a value stored in a vari
1. Pre-increment
```js
-let count = 0
-console.log(++count) // 1
-console.log(count) // 1
+let count = 0;
+console.log(++count); // 1
+console.log(count); // 1
```
1. Post-increment
```js
-let count = 0
-console.log(count++) // 0
-console.log(count) // 1
+let count = 0;
+console.log(count++); // 0
+console.log(count); // 1
```
We use most of the time post-increment. At least you should remember how to use post-increment operator.
@@ -281,17 +279,17 @@ In JavaScript we use the decrement operator to decrease a value stored in a vari
1. Pre-decrement
```js
-let count = 0
-console.log(--count) // -1
-console.log(count) // -1
+let count = 0;
+console.log(--count); // -1
+console.log(count); // -1
```
2. Post-decrement
```js
-let count = 0
-console.log(count--) // 0
-console.log(count) // -1
+let count = 0;
+console.log(count--); // 0
+console.log(count); // -1
```
### Ternary Operators
@@ -300,15 +298,15 @@ Ternary operator allows to write a condition.
Another way to write conditionals is using ternary operators. Look at the following examples:
```js
-let isRaining = true
+let isRaining = true;
isRaining
- ? console.log('You need a rain coat.')
- : console.log('No need for a rain coat.')
-isRaining = false
+ ? console.log("You need a rain coat.")
+ : console.log("No need for a rain coat.");
+isRaining = false;
isRaining
- ? console.log('You need a rain coat.')
- : console.log('No need for a rain coat.')
+ ? console.log("You need a rain coat.")
+ : console.log("No need for a rain coat.");
```
```sh
@@ -317,15 +315,15 @@ No need for a rain coat.
```
```js
-let number = 5
+let number = 5;
number > 0
? console.log(`${number} is a positive number`)
- : console.log(`${number} is a negative number`)
-number = -5
+ : console.log(`${number} is a negative number`);
+number = -5;
number > 0
? console.log(`${number} is a positive number`)
- : console.log(`${number} is a negative number`)
+ : console.log(`${number} is a negative number`);
```
```sh
@@ -344,11 +342,11 @@ I would like to recommend you to read about operator precedence from this [link]
As you have seen at very beginning alert() method displays an alert box with a specified message and an OK button. It is a builtin method and it takes on argument.
```js
-alert(message)
+alert(message);
```
```js
-alert('Welcome to 30DaysOfJavaScript')
+alert("Welcome to 30DaysOfJavaScript");
```
Do not use too much alert because it is destructing and annoying, use it just to test.
@@ -358,12 +356,12 @@ Do not use too much alert because it is destructing and annoying, use it just to
The window prompt methods display a prompt box with an input on your browser to take input values and the input data can be stored in a variable. The prompt() method takes two arguments. The second argument is optional.
```js
-prompt('required text', 'optional text')
+prompt("required text", "optional text");
```
```js
-let number = prompt('Enter number', 'number goes here')
-console.log(number)
+let number = prompt("Enter number", "number goes here");
+console.log(number);
```
### Window confirm() method
@@ -373,8 +371,8 @@ A confirm box is often used to ask permission from a user to execute something.
Clicking the OK yields true value, whereas clicking the Cancel button yields false value.
```js
-const agree = confirm('Are you sure you like to delete? ')
-console.log(agree) // result will be true or false based on what you click on the dialog box
+const agree = confirm("Are you sure you like to delete? ");
+console.log(agree); // result will be true or false based on what you click on the dialog box
```
These are not all the window methods we will have a separate section to go deep into window methods.
@@ -382,7 +380,7 @@ These are not all the window methods we will have a separate section to go deep
## Date Object
Time is an important thing. We like to know the time a certain activity or event. In JavaScript current time and date is created using JavaScript Date Object. The object we create using Date object provides many methods to work with date and time.The methods we use to get date and time information from a date object values are started with a word _get_ because it provide the information.
-_getFullYear(), getMonth(), getDate(), getDay(), getHours(), getMinutes, getSeconds(), getMilliseconds(), getTime(), getDay()_
+_getFullYear(), getMonth(), getDate(), getDay(), getHours(), getMinutes, getSeconds(), getMilliseconds(), getTime()_

@@ -391,8 +389,8 @@ _getFullYear(), getMonth(), getDate(), getDay(), getHours(), getMinutes, getSeco
Once we create time object. The time object will provide information about time. Let us create a time object
```js
-const now = new Date()
-console.log(now) // Sat Jan 04 2020 00:56:41 GMT+0200 (Eastern European Standard Time)
+const now = new Date();
+console.log(now); // Sat Jan 04 2020 00:56:41 GMT+0200 (Eastern European Standard Time)
```
We have created a time object and we can access any date time information from the object using the get methods we have mentioned on the table.
@@ -402,8 +400,8 @@ We have created a time object and we can access any date time information from t
Let's extract or get the full year from a time object.
```js
-const now = new Date()
-console.log(now.getFullYear()) // 2020
+const now = new Date();
+console.log(now.getFullYear()); // 2020
```
### Getting month
@@ -411,8 +409,8 @@ console.log(now.getFullYear()) // 2020
Let's extract or get the month from a time object.
```js
-const now = new Date()
-console.log(now.getMonth()) // 0, because the month is January, month(0-11)
+const now = new Date();
+console.log(now.getMonth()); // 0, because the month is January, month(0-11)
```
### Getting date
@@ -420,8 +418,8 @@ console.log(now.getMonth()) // 0, because the month is January, month(0-11)
Let's extract or get the date of the month from a time object.
```js
-const now = new Date()
-console.log(now.getDate()) // 4, because the day of the month is 4th, day(1-31)
+const now = new Date();
+console.log(now.getDate()); // 4, because the day of the month is 4th, day(1-31)
```
### Getting day
@@ -429,8 +427,8 @@ console.log(now.getDate()) // 4, because the day of the month is 4th, day(1-31)
Let's extract or get the day of the week from a time object.
```js
-const now = new Date()
-console.log(now.getDay()) // 6, because the day is Saturday which is the 7th day
+const now = new Date();
+console.log(now.getDay()); // 6, because the day is Saturday which is the 7th day
// Sunday is 0, Monday is 1 and Saturday is 6
// Getting the weekday as a number (0-6)
```
@@ -440,8 +438,8 @@ console.log(now.getDay()) // 6, because the day is Saturday which is the 7th day
Let's extract or get the hours from a time object.
```js
-const now = new Date()
-console.log(now.getHours()) // 0, because the time is 00:56:41
+const now = new Date();
+console.log(now.getHours()); // 0, because the time is 00:56:41
```
### Getting minutes
@@ -449,8 +447,8 @@ console.log(now.getHours()) // 0, because the time is 00:56:41
Let's extract or get the minutes from a time object.
```js
-const now = new Date()
-console.log(now.getMinutes()) // 56, because the time is 00:56:41
+const now = new Date();
+console.log(now.getMinutes()); // 56, because the time is 00:56:41
```
### Getting seconds
@@ -458,8 +456,8 @@ console.log(now.getMinutes()) // 56, because the time is 00:56:41
Let's extract or get the seconds from a time object.
```js
-const now = new Date()
-console.log(now.getSeconds()) // 41, because the time is 00:56:41
+const now = new Date();
+console.log(now.getSeconds()); // 41, because the time is 00:56:41
```
### Getting time
@@ -469,35 +467,35 @@ This method give time in milliseconds starting from January 1, 1970. It is also
1. Using _getTime()_
```js
-const now = new Date() //
-console.log(now.getTime()) // 1578092201341, this is the number of seconds passed from January 1, 1970 to January 4, 2020 00:56:41
+const now = new Date(); //
+console.log(now.getTime()); // 1578092201341, this is the number of seconds passed from January 1, 1970 to January 4, 2020 00:56:41
```
1. Using _Date.now()_
```js
-const allSeconds = Date.now() //
-console.log(allSeconds) // 1578092201341, this is the number of seconds passed from January 1, 1970 to January 4, 2020 00:56:41
+const allSeconds = Date.now(); //
+console.log(allSeconds); // 1578092201341, this is the number of seconds passed from January 1, 1970 to January 4, 2020 00:56:41
-const timeInSeconds = new Date().getTime()
-console.log(allSeconds == timeInSeconds) // true
+const timeInSeconds = new Date().getTime();
+console.log(allSeconds == timeInSeconds); // true
```
Let us format these values to a human readable time format.
**Example:**
```js
-const now = new Date()
-const year = now.getFullYear() // return year
-const month = now.getMonth() + 1 // return month(0 - 11)
-const date = now.getDate() // return date (1 - 31)
-const hours = now.getHours() // return number (0 - 23)
-const minutes = now.getMinutes() // return number (0 -59)
+const now = new Date();
+const year = now.getFullYear(); // return year
+const month = now.getMonth() + 1; // return month(0 - 11)
+const date = now.getDate(); // return date (1 - 31)
+const hours = now.getHours(); // return number (0 - 23)
+const minutes = now.getMinutes(); // return number (0 -59)
-console.log(`${date}/${month}/${year} ${hours}:${minutes}`) // 4/1/2020 0:56
+console.log(`${date}/${month}/${year} ${hours}:${minutes}`); // 4/1/2020 0:56
```
-🌕 You have boundless energy. You have just completed day 3 challenges and you are three steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
+🌕 You have boundless energy. You have just completed day 3 challenges and you are three steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
## 💻 Day 3: Exercises
@@ -507,10 +505,12 @@ console.log(`${date}/${month}/${year} ${hours}:${minutes}`) // 4/1/2020 0:56
2. Check if type of '10' is equal to 10
3. Check if parseInt('9.8') is equal to 10
4. Boolean value is either true or false.
+
1. Write three JavaScript statement which provide truthy value.
2. Write three JavaScript statement which provide falsy value.
5. Figure out the result of the following comparison expression first without using console.log(). After you decide the result confirm it using console.log()
+
1. 4 > 3
2. 4 >= 3
3. 4 < 3
@@ -525,6 +525,7 @@ console.log(`${date}/${month}/${year} ${hours}:${minutes}`) // 4/1/2020 0:56
12. Find the length of python and jargon and make a falsy comparison statement.
6. Figure out the result of the following expressions first without using console.log(). After you decide the result confirm it by using console.log()
+
1. 4 > 3 && 10 < 12
2. 4 > 3 && 10 > 12
3. 4 > 3 || 10 < 12
@@ -573,29 +574,29 @@ console.log(`${date}/${month}/${year} ${hours}:${minutes}`) // 4/1/2020 0:56
1. Calculate the value of y (y = x2 + 6x + 9). Try to use different x values and figure out at what x value y is 0.
1. Writ a script that prompt a user to enter hours and rate per hour. Calculate pay of the person?
- ```sh
- Enter hours: 40
- Enter rate per hour: 28
- Your weekly earning is 1120
- ```
+ ```sh
+ Enter hours: 40
+ Enter rate per hour: 28
+ Your weekly earning is 1120
+ ```
1. If the length of your name is greater than 7 say, your name is long else say your name is short.
1. Compare your first name length and your family name length and you should get this output.
- ```js
- let firstName = 'Asabeneh'
- let lastName = 'Yetayeh'
- ```
+ ```js
+ let firstName = "Asabeneh";
+ let lastName = "Yetayeh";
+ ```
- ```sh
- Your first name, Asabeneh is longer than your family name, Yetayeh
- ```
+ ```sh
+ Your first name, Asabeneh is longer than your family name, Yetayeh
+ ```
1. Declare two variables _myAge_ and _yourAge_ and assign them initial values and myAge and yourAge.
```js
- let myAge = 250
- let yourAge = 25
+ let myAge = 250;
+ let yourAge = 25;
```
```sh
@@ -604,14 +605,14 @@ console.log(`${date}/${month}/${year} ${hours}:${minutes}`) // 4/1/2020 0:56
1. Using prompt get the year the user was born and if the user is 18 or above allow the user to drive if not tell the user to wait a certain amount of years.
- ```sh
+ ```sh
- Enter birth year: 1995
- You are 25. You are old enough to drive
+ Enter birth year: 1995
+ You are 25. You are old enough to drive
- Enter birth year: 2005
- You are 15. You will be allowed to drive after 3 years.
- ```
+ Enter birth year: 2005
+ You are 15. You will be allowed to drive after 3 years.
+ ```
1. Write a script that prompt the user to enter number of years. Calculate the number of seconds a person can live. Assume some one lives just hundred years
diff --git a/Turkish/03_Day_Booleans_operators_date/03_booleans_operators_date.md b/Turkish/03_Day_Booleans_operators_date/03_booleans_operators_date.md
index 65b7271..f64fd2e 100644
--- a/Turkish/03_Day_Booleans_operators_date/03_booleans_operators_date.md
+++ b/Turkish/03_Day_Booleans_operators_date/03_booleans_operators_date.md
@@ -1,5 +1,5 @@