From cd416cd42ed11f1ded6733c7831835c54db3156b Mon Sep 17 00:00:00 2001 From: Ali Akkoyun Date: Sat, 23 Jul 2022 21:27:08 +0300 Subject: [PATCH 1/3] degisik --- 02-degisken-tanimlama.js | 45 ++++++++++++++++ 04-number-veri-turu-ile-calismak.js | 70 +++++++++++++++++++++++++ 05-boolean-veri-turu-ile-calismak.js | 29 ++++++++++ 06-veri-turu-ve-veri-turu-donusumler.js | 29 ++++++++++ index.html | 15 ++++++ 5 files changed, 188 insertions(+) create mode 100644 02-degisken-tanimlama.js create mode 100644 04-number-veri-turu-ile-calismak.js create mode 100644 05-boolean-veri-turu-ile-calismak.js create mode 100644 06-veri-turu-ve-veri-turu-donusumler.js create mode 100644 index.html diff --git a/02-degisken-tanimlama.js b/02-degisken-tanimlama.js new file mode 100644 index 00000000..9cfd2fae --- /dev/null +++ b/02-degisken-tanimlama.js @@ -0,0 +1,45 @@ +// let ve const ile Degisken Tanimlama + +// var ile degisken tanimlama + +/* +var serverName = "kodluyoruz.org" +console.log(serverName) +*/ + +// let ile degiskeni bos tanimlamak + +/* +let serverName +console.log(serverName) +serverName = "kodluyoruz.org" +console.log(serverName) +*/ + +// let ile degiskene bilgi atayarak tanimlamak + +/* +let password = "1234" +console.log(password) +*/ + +//degisken atamasi yapmadan once kullanamya calismak + +/* +var fullName = "Hakan Yalcinkaya" +console.log(fullName) +*/ + +// Birlestirme veya ekleme islemi + +/* const nameUser = "Hakan" +const surName = "Yalcinkaya" +console.log(`${nameUser} ${surName}`) */ + + +// const ile degiskeni bos tanimlamaya calismak + +/* const $ali = "a" +console.log($ali) */ + +// const ile degisken tanimlamak \ No newline at end of file diff --git a/04-number-veri-turu-ile-calismak.js b/04-number-veri-turu-ile-calismak.js new file mode 100644 index 00000000..fdb66442 --- /dev/null +++ b/04-number-veri-turu-ile-calismak.js @@ -0,0 +1,70 @@ +// number + +// number veri turu tanimlamak + +let price = 100 +let tax = 0.18 +let priceTax = price * tax +let total = price + priceTax + +console.log( + "Fiyat: " , price, + " KDV Oranı: " , tax, + " KDV Tutari: " , priceTax, + " Fiyat : ", total +) + +// arttirma ve azaltma islemleri + +let counter = 320 +counter = counter + 1 +counter += 1 +counter ++ +console.log(counter) + +counter -- +counter -= 1 +console.log(counter) + +counter *= 10 +console.log(counter) + +counter /= 2 +console.log(counter) + + +// islem onceligi: + +console.log((2 + 3) * 10) // 50 cikmali ? + +// mod (kalan) alma % + +console.log("10'u 2'ye böldüğümüzde kalan: ",10 % 2) +console.log("10'u 3'e böldüğümüzde kalan: ",10 % 3) + +// 8 urun alan koliye tum urunler sigiyor mu ? + +console.log("Koli Kalan Urun ornegi: ", 18 % 2 ) + +// us alma ** + +console.log("2'nin 3. kuvveti: ",2**3) + +// asagi yuvarlama islemi -> Math.floor + +console.log("3.3 asagi yuvarlama:",Math.floor(3.8)) + +// Yukari yuvarlama islemi -> Math.ceil + +console.log("3.8 yukari yuvarlama:", Math.ceil(3.8)) + +// yakina yuvarlama islemi -> Math.round + +console.log("3.4 asagimi yukarimi:", Math.round(3.4)) + + + +//String to Number Convert (Convert.toInt gibi) +let stringNumber = "11" + +let nemNumber = Number(stringNumber) \ No newline at end of file diff --git a/05-boolean-veri-turu-ile-calismak.js b/05-boolean-veri-turu-ile-calismak.js new file mode 100644 index 00000000..dae53a3e --- /dev/null +++ b/05-boolean-veri-turu-ile-calismak.js @@ -0,0 +1,29 @@ +// boolean + +// 0 ve 1 + +/*let isActive = false //0 +isActive = true //1 */ + +/* let userName; +let isUserName = Boolean(userName) +console.log(isUserName) */ // İsim olmadığı icin false doner. + + +// 0, -0, null, false, NaN, undefined, ("") + +console.log(Boolean(0)) // false +console.log(Boolean(-0)) // false +console.log(Boolean(null)) // false +console.log(Boolean(false)) // false +console.log(Boolean(NaN)) // false +console.log(Boolean(undefined)) // false +console.log(Boolean("")) // false + +var x = 10 / 'java' +console.log(Boolean(x)) + + + + + diff --git a/06-veri-turu-ve-veri-turu-donusumler.js b/06-veri-turu-ve-veri-turu-donusumler.js new file mode 100644 index 00000000..816ac5a0 --- /dev/null +++ b/06-veri-turu-ve-veri-turu-donusumler.js @@ -0,0 +1,29 @@ +// Veri Turunu Ogrenmek ve Veri Turu Donusumleri + + +// veri turunu ogrenmek typeof + +let price = 111 +let stringPrice = "111" +let hasPassword = true + +console.log( +"Price : " , typeof(price) +) + +console.log( + "String Price : " , typeof(stringPrice) +) + +console.log( + "Has Password : " , typeof(hasPassword) +) + + +// string(metinsel) bilgileri int ve floata donusturmek + +let number = "11" + +console.log( + "number1 : ", parseInt(number1) +) diff --git a/index.html b/index.html new file mode 100644 index 00000000..e97a310c --- /dev/null +++ b/index.html @@ -0,0 +1,15 @@ + + + + + + + Kodluyoruz + + + + + + From cbc2b5dff60992e521e54bac73596a9457c45e26 Mon Sep 17 00:00:00 2001 From: Ali Akkoyun Date: Sat, 23 Jul 2022 21:55:43 +0300 Subject: [PATCH 2/3] 07 --- 06-veri-turu-ve-veri-turu-donusumler.js | 32 ++++++++++++++++++++++++- 07-template-literals-kullanimi.js | 21 ++++++++++++++++ index.html | 2 +- 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 07-template-literals-kullanimi.js diff --git a/06-veri-turu-ve-veri-turu-donusumler.js b/06-veri-turu-ve-veri-turu-donusumler.js index 816ac5a0..e5379824 100644 --- a/06-veri-turu-ve-veri-turu-donusumler.js +++ b/06-veri-turu-ve-veri-turu-donusumler.js @@ -25,5 +25,35 @@ console.log( let number = "11" console.log( - "number1 : ", parseInt(number1) + "number1 : ", parseInt(number) ) + +let number2 = "11px" // 11px -> parseInt(number2) -> number = 11 + // px11px -> parseInt(number2) -> number = NaN + // 11px11 -> parseInt(number2) -> number = 11 +console.log( + "number2 : ", parseInt(number2) +) + +let number3 = "11.1" +number3 = Number(number3) +console.log( + "number3 : ", number3, typeof(number3) +) + +let number4 = "11.4px" +number4 = parseFloat(number4) // icerisinde '11.4px' string ifade oldugu icin Number(number4) seklinde donusturme yapilamaz. + // eger '11.4px' bu yapiyi sayiya cevirmek istersek parseFloat(number4) diyerek 11.4'e cevirebiliriz. + // parseFloat(number4) -> parse parçala demektir. verilen ifadenin (basi string olamaz) sayi kismini alir. +console.log( + "number4 : ", number4, typeof(number4) +) + + +// number veri tipinden string'e donusturmek: + +let number5 = 55 +number5=number5.toString() +console.log( + typeof(number5) +) \ No newline at end of file diff --git a/07-template-literals-kullanimi.js b/07-template-literals-kullanimi.js new file mode 100644 index 00000000..df77f2c2 --- /dev/null +++ b/07-template-literals-kullanimi.js @@ -0,0 +1,21 @@ +// Template Literals Kullanimi + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals + +let username = "hakan" +const DOMAIN = "kodluyoruz.org" + +let email = username + "@" + DOMAIN + +console.log( + "Merhaba", username, "sitemize hosgeldin", "mail adresin: ", email, " mail uzunlugu: ", email.length +) + +let info = `Merhaba ${username} sitemize hosgeldin.. +mail adresin: ${email} +mail adresinin uzunlugu : ${email.length} +borcunuz: ${ (2 + 3) * 5} TL +gunun saat bilgisi: ${new Date().getHours()} +` + +console.log(info) diff --git a/index.html b/index.html index e97a310c..0747d584 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ Kodluyoruz - From b3c7845cc436bfe6d290624f27643d2e88c2064d Mon Sep 17 00:00:00 2001 From: Ali Akkoyun Date: Sat, 23 Jul 2022 22:29:26 +0300 Subject: [PATCH 3/3] 08 bitti --- 08-string-veri-turu-islemleri.js | 61 ++++++++++++++++++++++++++++++++ index.html | 2 +- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 08-string-veri-turu-islemleri.js diff --git a/08-string-veri-turu-islemleri.js b/08-string-veri-turu-islemleri.js new file mode 100644 index 00000000..309abbd3 --- /dev/null +++ b/08-string-veri-turu-islemleri.js @@ -0,0 +1,61 @@ +// String Veri Turu Islemleri +// https://www.w3schools.com/jsref/jsref_obj_string.asp + +let mail = "hakanyalcinkaya@gmail.com" +let firstName = "hakan" +let lastName = "YALCINKAYA" + +// string karakter sayisi -> length +console.log( + "firs name uzunluk: ", firstName.length +) +// ılk karakteri bulmak -> [0] + +console.log( + "first name birinci karakter: ", firstName[0] // 1. yontem +) + +console.log( + "first name birinci karakter: ", firstName.charAt(0) +) + +// buyuk harf / kucuk harf +console.log( + "first name once: ", firstName , "first name sonra: ", firstName.toUpperCase() +) + +console.log( + "last name once: ", lastName , "last name sonra: ", lastName.toLowerCase() +) + +// string icinde istedigimiz bilgiyi aramak ve yerini bulmak -> search && bellir bir yere kadar al -> slice + +console.log( + mail.search("@") +) + +mail.search("olmayan") // yok ise -1 , var ise yerini gosterir. + +let DOMAIN = mail.slice(mail.search("@") + 1 ) +console.log(DOMAIN) + +console.log( + DOMAIN.slice(0,DOMAIN.indexOf(".")) +) // gmail kismini aldik + +// bilgiyi degistir -> replace +mail = mail.replace("gmail.com","hotmail.com") // gmail.com -> hotmail.com ile degistirdik +console.log(mail) + +// istedigim bilgi var mi ? -> includes +console.log(mail.includes("hotmail.com")) // var ise true yok ise false doner + + +// istdigim bilgiyle basladi mi ? bitti mi -> startsWidth, endsWidth +console.log(mail.endsWith("hotmail.com")) // basladi veya bittiyse true, degil ile false doner + + +// ilk harflerini buyuk yapmak +let fullname = `${firstName[0].toUpperCase()}${firstName.slice(1).toLowerCase()} ${lastName[0].toUpperCase()}${lastName.slice(1).toLowerCase()}` + +console.log(fullname) diff --git a/index.html b/index.html index 0747d584..2f287344 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ Kodluyoruz -