Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bilal-ceyhun-madlibs #160

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions class-13-map-reduce/khadija-ceyhun/map-exercise/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
console.log("---------------------Q1---------------------")
const capitalize = function(string){
return string.toUpperCase();
}

let string4q1 = "obviously"

// const capitalizeee = string.split().map((word ,index) => capitalize(word));
const capitalizeee = string4q1.split().map(capitalize);
console.log(capitalizeee.toString())





console.log("---------------------Q2---------------------")
let string4q2 = 'hey gurl, lets javascript together sometime'

function swapCase(string4q2){
const strintoarr = string4q2.split(" ");
let emptyStr = ""
const test = strintoarr.map(function(arr, index){
if(index % 2 === 0){
emptyStr += arr.toLowerCase() + " ";
}
else{
emptyStr += arr.toUpperCase() + " ";
}
return emptyStr
})
console.log(emptyStr)
return emptyStr
}

swapCase(string4q2)





console.log("---------------------Q3---------------------")
const stringQ3 = "abcxyz"


function shiftLetters(string, num = 1){
const question3toarr = stringQ3.split(" ");
return question3toarr.map(function(array, index){
let result = " "
let charcode = 0
for(let i = 0; i < stringQ3.length; i++){
charcode = stringQ3[i].charCodeAt() + num
result += String.fromCharCode(charcode)
}
return result
})
}

shiftLetters(stringQ3)
115 changes: 115 additions & 0 deletions class-13-map-reduce/khadija-ceyhun/map-reduce-exercise/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
console.log("---------------------Q1---------------------")
let exampleBudget = [
{ name: "John", age: 21, budget: 23000 },
{ name: "Steve", age: 32, budget: 40000 },
{ name: "Martin", age: 16, budget: 2700 }
]

//➞ 65700

function question1(){
let wow = 0
exampleBudget.reduce(function(sum, obj){
// console.log("Sum: ", sum, "obj: ", obj.budget)
wow = sum + obj.budget
return (wow)
},0)
console.log(wow)
}

question1()




console.log("---------------------Q2---------------------")
// countLetters('abbcccddddeeeee')
// => {a:1, b:2, c:3, d:4, e:5}


const countLetters = function(string){
let stringArr = string.split("")
// console.log(stringArr)
// let stringArrv2 = string.split(" ")
// console.log(stringArrv2)
return stringArr.reduce(function(repeat, char){
if(char in repeat) repeat[char]++
else repeat[char] = 1
return repeat
},{})
};
console.log("aaaaaabbcccddddeeeee: \n", countLetters('aaaaaabbcccddddeeeee'))
console.log("\nabbcccddddeeeee: \n", countLetters("abbcccddddeeeee"))





console.log("---------------------Q3---------------------")
// Working properly without map
// const stringQ3 = "abcxyz"
// isPresent('abcd', 'b') // => true
// isPresent('efghi', 'a') // => false

// const isPresent = function(string, target) {
// let checkMic;
// for(let i = 0; i < string.length; i++){
// if(string[i] === target){
// checkMic = true
// }
// else{
// checkMic = false
// }
// return checkMic
// }
// }

// console.log(isPresent(stringQ3, "j"))
// console.log(isPresent(stringQ3, "a"))



const stringQ3 = "abcxyz"
const stringQ3Arr = stringQ3.split("")

const isPresentt = function(array, target) {
return stringQ3Arr.map(function(charrr,index){
// console.log("charrr: ", charrr, "index: ", index, "target: ", target)
let checkMicMic;
if(charrr === target){
checkMicMic = true
}
else{
checkMicMic = false
}
return (checkMicMic)
})
}

console.log("abcxyz: ", "a" ,isPresentt(stringQ3, "a"))
console.log("abcxyz: ", "x" ,isPresentt(stringQ3, "x"))
console.log("abcxyz: ", "j" ,isPresentt(stringQ3, "j"))


console.log("---------------------Q4---------------------")

const decode = function(codes){
let finalEmptyArr = []

codes.split(" ").map(function(value){
let adder = value.split("").reduce(function(accuu, currentValue){
// console.log("accuu: ", accuu, "currentValue: ", currentValue)
return accuu += parseInt(currentValue);
}, 0);
let word = String.fromCharCode(adder)
// console.log(word)
finalEmptyArr.push(word)
return finalEmptyArr
})
// finalEmptyArr.toString()
// console.log(finalEmptyArr)
return finalEmptyArr.toString()
}

console.log(decode ("361581732726247521644353 4161492813593986955"))
console.log(decode("444689936146563731 2452966188592191874 52634311978613959924676311 4874232339 491973615889195397613151 64491375479568464397 2799868298847212752434 9464245911 84529438455334236247245 8131257451645317232949247 26471594451453281675411332 6631592725297745964837 616698332453173937881461 3311783543427862468268 385418321228899775431 4659867 73395213225525916984356 833792195426925124155181841 123388893 6941777837193213644325351 11353488912476869536954 61173937137292328237388335 5344692 452956158 31937616696951768494 584842118999165552436 8832121577139589884 15282516522883423742885 14713349724 6919979438697694 2252585676244745856486 5617683424485959291 547443594 2678324174797795449925 43753791352187862731151912 6875665565836721939262 35482977 84421878934473534291995 798457553821668942312 11114498238219156246883553 3599955 8831995953696776 8138759916933117676486 2388776737768787 37232647683297835458183 11318659392964788174775 683293746169875551252354 741545327395636643318531 38447974824822841161273 88768222547689886222 6345677462396774359 4942661761 1354569165 2553653936124138282 851786784517417366411515 42279319649497959785 5523951771 45941761289678527316294 37776454913244819275691 436669892715419465494342 682264111527 734681268219555989841131 882641896825571288724 382545666 12133138432672285179566156291 83644842221351483476411355532 9589336353993598224 184537669759184472427331 41851326945453796784 525783591 173773335961894524914465 47516715963756294236321 7296569497726217615 79487235 4931878519724923131437 31214731844284735237658435 1378458823933518466122 1241955123792435126557994 347427652476673662454 55596877477154112241923 9789414554758712319821 86228624276917113671233411 89659521 1352796469161477381192 69483824148396716861472 4766533634762298963245 5155973593459278561 1784478259974148659431 29583142566714785218623 244371427148584159487652 871836193187759591363 247956"))
59 changes: 59 additions & 0 deletions class-14-js-wheresWaldo/ayshe-ceyhun/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
let array1 = [
["d", "c", "c", "c"],
["c", "c", "c", "c"]
]

let array2 = [
["A", "A", "A"],
["A", "A", "A"],
["A", "A", "B"]
]


let array3 = [
["O", "O", "O", "O"],
["O", "O", "O", "O"],
["O", "O", "O", "O"],
["O", "O", "O", "O"],
["P", "O", "O", "O"],
["O", "O", "O", "O"]
]


function whereIsWaldo(array){
// console.log(array) -> outer
// console.log(array[0]) -> inner
for(let i = 0; i < array.length; i++){
console.log("Outer Array: ",array[i])

for(let j = 0; j < array[i].length; j++){
console.log("Inner Array: ",array[i][j])


if(array[i][j] !== array[0][0]){
console.log("Char: ", array[i][j])
let waldo = [i+1, j+1]
console.log("IF WORKED: ", waldo)
return waldo
}
else if(array[0][1] !== array[0][0] && array[0][2] !== array[0][0]){
let waldo = [i+1, j+1]
console.log("ELSE IF WORKED: ", waldo)
return waldo
}
else{
console.log("ELSE WORKED\n")
continue
}


}
}
}

console.log("ARRAY1")
console.log(whereIsWaldo(array1))
console.log("\n\nARRAY2")
console.log(whereIsWaldo(array2))
console.log("\n\nARRAY3")
console.log(whereIsWaldo(array3))
78 changes: 78 additions & 0 deletions class-15-js-OOP/isa-ceyhun/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
class Car {
// Part 1. Constructor (REVIEW)
constructor(color, fuelType) {
this.color = color;
this.fuelType = fuelType;
}

// Method.
paint(newColor) {
return this.color = newColor;
}

// Part 2. Static methods.
hasTheSameProperties(car2){
return this.color === car2.color &&
this.fuelType === car2.fuelType
}

static hasTheSamePropertiesStatic(car1, car2) {
return car1.color === car2.color &&
car1.fuelType === car2.fuelType
}


// Part 3. Getter, setter.
get speedKmH() {
return this.speed
}


set speedKmH(newTopSpeedKmH) {
//Question 2
if(newTopSpeedKmH > 300){
console.log("You're a fastest boi. You should calm down.")
}
else{
this.speed = newTopSpeedKmH
}
}

get speedInMiles() {
return this.speed * 0.621371
}


//Question 1
static compareSpeed(car1, car2){
if(car1.speed < car2.speed){
console.log(car2)
}
else{
console.log(car1)
}
}


//Question 3
get speedInKmSec(){
return this.speed / 3600
}


}

const audi = new Car("red","gas")
const tesla = new Car('red', "electric")

audi.paint('blue')

audi.speedKmH = 330
tesla.speedKmH = 290
// we call getter without paranthies
console.log("Audi: ", audi)
console.log("Tesla: ", tesla)

console.log(tesla.speedInKmSec)

// console.log(audi.hasTheSameProperties(tesla))
30 changes: 30 additions & 0 deletions class-17-js-review/hafiseNur-ceyhun/bootcamp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"title":"Turkey Bootcamp",
"instructors":["Halit", "Muhannad", "Shrreya", "Ammar"],
"students" : [
"Abduallah barmu",
"Abdulkadir İsa Tekinkaya",
"Ali Rıza Şahin",
"AYSE CIMEN BASAR",
"Ayşe Saflo",
"aziza iliasova",
"Belal Awad",
"Buse Şentürk",
"Ceyhun Gülbaş",
"Derya Kaygisiz",
"Hafise Nur Bacaksız",
"Khadija hawa",
"Kutay Kağan Özen",
"Mahmoud Moulham Hallak",
"MHD ABDULRAHMAN TAJI",
"Mohamad Moumen Hallak",
"Mohamad Ziada",
"Mohammed Alalaya",
"Muhammed Menar Yazıcı",
"Mustafa Şükrü Güldağ",
"Nidal Alrifai",
"Rahaf Shora",
"Ufuk Deniz Demirbilek",
"Yeşim Nur Akar"
]
}
33 changes: 33 additions & 0 deletions class-17-js-review/hafiseNur-ceyhun/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>repl.it</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<h3>A list of students first name</h3>
<div id="studentsFirstName"></div>
<hr>
<h3>A list of students names start with "M"</h3>
<div id="studentsNamesStartWthM"></div>
<hr>
<h3>Number of students names starts with "E"</h3>
<div id="NumberOfStudentsNamesStartsWithE"></div>
<hr>
<h3>Index of first student name starts with "H"</h3>
<div id="IndexOfFirstStudentNameStartsWithH"></div>
<h3>List Of Everybody</h3>
<div id="listOfEverybody"></div>




<script src="script.js">
</script>
</body>

</html>
Loading