Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

JavaScript-Core-2-Week3-Homework #63

Open
wants to merge 82 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
f82daf1
Update exercise-part-0.js
ISTANBULBEKLE Jul 12, 2020
c75f877
Update exercise-part-1.js
ISTANBULBEKLE Jul 12, 2020
5a5b8b9
Update exercise-part-2.js
ISTANBULBEKLE Jul 12, 2020
ed3da13
Update exercise-1.js
ISTANBULBEKLE Jul 12, 2020
c385de7
Update exercise-2.js
ISTANBULBEKLE Jul 12, 2020
4455b71
Update exercise-3.js
ISTANBULBEKLE Jul 12, 2020
e440be8
Update exercise-4.js
ISTANBULBEKLE Jul 13, 2020
b17480a
Update exercise-1.js
ISTANBULBEKLE Jul 13, 2020
50ce04e
Update exercise-2.js
ISTANBULBEKLE Jul 13, 2020
1fab184
Update exercise-3.js
ISTANBULBEKLE Jul 13, 2020
44faef6
Update exercise-1.js
ISTANBULBEKLE Jul 13, 2020
db0da49
Update exercise-2.js
ISTANBULBEKLE Jul 13, 2020
9ac8cff
Update exercise-3.js
ISTANBULBEKLE Jul 13, 2020
289f8cf
Update exercise-4.js
ISTANBULBEKLE Jul 13, 2020
0034d47
de exe files revised
ISTANBULBEKLE Jul 13, 2020
b350c6a
ex files are revised
ISTANBULBEKLE Jul 13, 2020
d614d5d
week1 ex are done
ISTANBULBEKLE Jul 13, 2020
3af2b1e
class ex E is done
ISTANBULBEKLE Jul 13, 2020
c517c86
class ex F is done
ISTANBULBEKLE Jul 13, 2020
c531bb8
week-1 mandatory 1-writers.js is done
ISTANBULBEKLE Jul 13, 2020
9c35da9
week1 mandatory 2-water-bottle.js is done
ISTANBULBEKLE Jul 13, 2020
567ef03
week1 mandatory 3-groceries.js is done
ISTANBULBEKLE Jul 13, 2020
08cae37
week1 projects 1-recipes.js is done
ISTANBULBEKLE Jul 14, 2020
682361a
revision continued
ISTANBULBEKLE Jul 14, 2020
e4cc909
inclass ex D-exersice-5.js is done
ISTANBULBEKLE Jul 14, 2020
3cd8dbc
week1-inclass-ex exercise-3.js is done
ISTANBULBEKLE Jul 14, 2020
f273bc4
Update exercise-3.js
ISTANBULBEKLE Jul 15, 2020
cc9bbda
revision
ISTANBULBEKLE Jul 17, 2020
3333d34
Update exercise.js
ISTANBULBEKLE Jul 20, 2020
ea85aa2
Update index.html
ISTANBULBEKLE Jul 20, 2020
2df59d5
inClass exercise.js is done
ISTANBULBEKLE Jul 21, 2020
5582c2d
Update exercises.js
ISTANBULBEKLE Jul 21, 2020
89886c1
evercise.js part3 is revised
ISTANBULBEKLE Jul 21, 2020
c86fbf8
mandatory 3-project is done
ISTANBULBEKLE Jul 21, 2020
c3bb57f
feedback by TA is done
ISTANBULBEKLE Jul 22, 2020
68ff0f2
feedback issues are revised
ISTANBULBEKLE Jul 22, 2020
dc80e55
A-dom-manipulation is done
ISTANBULBEKLE Jul 22, 2020
be4e377
images are aded
ISTANBULBEKLE Jul 22, 2020
818c57a
mandatory 2 and 3 is revised
ISTANBULBEKLE Jul 23, 2020
b086e2e
mandatory 3-project is done
ISTANBULBEKLE Jul 23, 2020
a4a935c
revised
ISTANBULBEKLE Jul 24, 2020
5af7f6c
exercise-2 is finished
ISTANBULBEKLE Jul 24, 2020
acadaf5
week1 inclass exercise-1 part-a is done
ISTANBULBEKLE Jul 26, 2020
4cc9e18
inClass exercise.js part 2 is done
ISTANBULBEKLE Jul 27, 2020
9f6255a
inClass exercise2 is done
ISTANBULBEKLE Jul 27, 2020
349dcd5
revised
ISTANBULBEKLE Jul 27, 2020
74a7070
inClass exercise2 is done
ISTANBULBEKLE Jul 27, 2020
d267d7d
exercises are done
ISTANBULBEKLE Jul 27, 2020
0e7de6c
alarmclock is revised
ISTANBULBEKLE Jul 28, 2020
be371b7
quotes is revised
ISTANBULBEKLE Jul 28, 2020
3a84d72
quotes revised
ISTANBULBEKLE Jul 28, 2020
8cacd06
quotes is revised
ISTANBULBEKLE Jul 28, 2020
61c3130
quotes is revised
ISTANBULBEKLE Jul 29, 2020
b154b4b
Update exercise.js
ISTANBULBEKLE Jul 29, 2020
dea0476
mandatory alarm clock is done
ISTANBULBEKLE Jul 29, 2020
8f1d43a
quotes.js is revised
ISTANBULBEKLE Jul 30, 2020
3040ecb
slideshow is revised
ISTANBULBEKLE Jul 30, 2020
25abf2f
slideshow is revised
ISTANBULBEKLE Jul 31, 2020
1a9174d
quotes
ISTANBULBEKLE Jul 31, 2020
922a0e7
mandatory q3 is revised
ISTANBULBEKLE Jul 31, 2020
3322b3a
Merge branch 'master' of https://github.com/ISTANBULBEKLE/JavaScript-…
ISTANBULBEKLE Jul 31, 2020
ac07a4f
mandatory q2 is revised
ISTANBULBEKLE Jul 31, 2020
5c7e92e
mandatory q 2 is revised
ISTANBULBEKLE Aug 2, 2020
c82c1f3
mandatory q 2 is revised
ISTANBULBEKLE Aug 2, 2020
d93f620
Update slideshow.js
ISTANBULBEKLE Aug 4, 2020
765ba2a
revisions continued
ISTANBULBEKLE Aug 5, 2020
84c2ba5
mandatory q3 is done
ISTANBULBEKLE Aug 5, 2020
3b18bd3
mandatory q3 is revised
ISTANBULBEKLE Aug 5, 2020
15de1d3
Update slideshow.js
ISTANBULBEKLE Aug 5, 2020
001cca9
Update exercise.js
ISTANBULBEKLE Aug 5, 2020
b5a74a9
Update exercise.js
ISTANBULBEKLE Aug 5, 2020
65dbb6e
inClass exercise 2 is revised
ISTANBULBEKLE Aug 5, 2020
6b4c4d4
exercise revised
ISTANBULBEKLE Aug 5, 2020
1915a76
revised
ISTANBULBEKLE Aug 7, 2020
624d986
Update exercise.js
ISTANBULBEKLE Aug 7, 2020
8c107c0
mandatory 2 is revised
ISTANBULBEKLE Aug 7, 2020
cc93d81
rvised
ISTANBULBEKLE Aug 12, 2020
2be6f47
InClass/DOM-practice/main is revised
ISTANBULBEKLE Aug 24, 2020
17b9b85
week-3 callback exercise are revised
ISTANBULBEKLE Aug 25, 2020
3fbd452
exercise callback is revised
ISTANBULBEKLE Aug 25, 2020
41e8a74
alarmclock is revised
ISTANBULBEKLE Aug 25, 2020
7d19efc
update alarmclock
ISTANBULBEKLE Aug 25, 2020
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5504
}
22 changes: 22 additions & 0 deletions Week-1/Homework/mandatory/1-writers.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,28 @@ let writers = [
}
];

/* for (let key in writers){

//console.log(writers[key]);

console.log(` Hi, my name is ${writers[key].firstName} ${writers[key].lastName}. I am ${writers[key].age} years old, and works as a ${writers[key].occupation}.`);
} */
///////////////////////////////////////////////////////////
//Writing with forEach() array method;
let writeNames = writers.forEach(writer => {
console.log (` Hi, my name is ${writer.firstName} ${writer.lastName}. I am ${writer.age} years old, and works as a ${writer.occupation}.`)
})
/////////////////////////////////////////////////////////////
/*
If you want an extra challenge, only `console.log()` the writers that are alive.
*/

for (let key in writers){

if(writers[key].alive === true){
console.log(` Hi, my name is ${writers[key].firstName} ${writers[key].lastName}. I am ${writers[key].age} years old, and works as a ${writers[key].occupation}.`);
}
else{
console.log(`${writers[key].firstName} ${writers[key].lastName} is death.`)
}
}
7 changes: 5 additions & 2 deletions Week-1/Homework/mandatory/2-water-bottle.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ We made a start on this for you here:
let bottle = {
volume: 0,
fill: function() {
this.volume = 100;
// calling this function should make you bottles volume = 100;
},
drink: function() {
this.volume -= 10;
// calling this function should decrease your bottles volume by 10;
},
empty: function() {
empty: function( ) {
return this.volume === 0;
}
// this function should return true if your bottles volume = 0
}
};

/*
Expand Down
9 changes: 6 additions & 3 deletions Week-1/Homework/mandatory/3-groceries.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
let groceriesToBuy = [];

let groceryList = {
item1: "",
item2: "",
item3: ""
item1: "Potatoes",
item2: "Orange Juice",
item3: "Rice",
};

groceriesToBuy = Object.values(groceryList);
console.log(groceriesToBuy);
11 changes: 10 additions & 1 deletion Week-1/Homework/projects/1-recipes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,13 @@ cocoa

**/

let recipes = {};
let recipeCard = {
title: "Mole",
serves:2,
ingredients:["cinnemon", "cumin", "cocoa"]
};

console.log(recipeCard);
console.log(recipeCard.title);
console.log(recipeCard.serves);
console.log(recipeCard.ingredients);
41 changes: 32 additions & 9 deletions Week-1/Homework/projects/2-reading-list.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**

/*
The Reading List
Keep track of which books you read and which books you want to read!

=====
Exercise 1
===== */

/* Exercise 1
=====
Create an array of objects, where each object describes a book and has properties for:

Expand All @@ -15,14 +15,37 @@ Create an array of objects, where each object describes a book and has propertie
Loop through the array of books. For each book, log the book title and book author like so:

"The Hobbit by J.R.R. Tolkien"

=====
*/

let book1={
title:"Flat Stanley",
author: "J.Greenhut",
alreadyRead: true,
}
let book2= {
title:"Astrosaurs",
author: "Steve Cole",
alreadyRead: true,
}
let book3= {
title:"Horrid Henny and the Demon Dinner Lady",
author: "Francesca Simon",
alreadyRead: false,
}

let myBooks=[book1, book2, book3]

/* ====
Exercise 2
=====
Now use an if/else statement to change the output depending on whether you read it yet or not.

If you read it, log a string like 'You already read "The Hobbit" by J.R.R. Tolkien', and if not, log a string like 'You still need to read "The Lord of the Rings" by J.R.R. Tolkien.'
*/
function checkRead (book){
if (book.alreadyRead === true;){
return
}

}

**/

let books = [];
11 changes: 10 additions & 1 deletion Week-1/InClass/A-objects-intro/exercise-part-0.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,13 @@ Describe your own laptop as a JavaScript object

Try to think of as many properties as you can!

*/
*/

let myLaptop = {
brand: "MacBook",
screenSize: 13,
hardDisc: 128,
microChip: "8 Gen I5",
operatingSystem: "MacOs",
RAM: 8,
}
43 changes: 43 additions & 0 deletions Week-1/InClass/A-objects-intro/exercise-part-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,46 @@ Assign each of them to a separate variable

*/

let myCar ={
color: "black",
made:"Vauxhall",
model:"Insignia",
engine:2,
productionYear:2015,
}

let BoschSession1 ={
chapter1:"TIS",
chapter2:"Lost Night",
chapter3:"Blue Religion",
chapter4:"Fugazi",
chapter5:"Mam's Boy",
chapter6:"Donkey's Years",
chapter7:"Lost Boys",
chapter8:"High Low",
chapter9:"The Magic Castle",
chapter10:"Us and Them",
}

let garden ={
width:5,
length:7,
tress: ["Oak", "beech", "ash", "birch"],
patio:true,
}

let livingRoom ={
size: "3m * 3m",
TVStand:true,
window:2,
floor: "laminat parke",
radiators:3,
}

let browniCake ={
flour: 10,
egggs: 2,
butter: 15,
sugar: 5,
cholatte: 10,
}
19 changes: 10 additions & 9 deletions Week-1/InClass/A-objects-intro/exercise-part-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ The objects below have some syntax issues - try and fix them all!
*/

let kitten = {
fur colour: "orange",
age "23"
};
furColour: "orange",
age: "23",
}

let laptop =
brand: "Lenovo"
ram "5GB"
let laptop = {
brand: "Lenovo",
ram: "5GB",
}

let phone = {
operating system "iOS",
operatingSystem: "iOS",
hasStylus: true,
megapixels 12
"batteryLife": "24 hours"
megapixels: 12,
batteryLife: "24 hours",
}
4 changes: 4 additions & 0 deletions Week-1/InClass/B-objects-get-set/exercise-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ let kitten = {

// YOUR CODE GOES BELOW HERE

console.log(kitten);
console.log(kitten.ageMonths);
console.log(kitten.isFemale);
console.log(kitten["furColour"]);



Expand Down
12 changes: 6 additions & 6 deletions Week-1/InClass/B-objects-get-set/exercise-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
*/

let phone = {
brand: 'iPhone,
model 'iPhone X'
brand: 'iPhone',
model: 'iPhone X',
launchYear: 2017,
is Unlocked: true
;
isUnlocked: true,
};

let phoneBrand = phone.bbrand;
let phoneLaunchYear = phone[launchYear];
let phoneBrand = phone.brand;
let phoneLaunchYear = phone["launchYear"];

// DO NOT MODIFY BELOW THIS LINE

Expand Down
6 changes: 5 additions & 1 deletion Week-1/InClass/B-objects-get-set/exercise-3.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
*/

// WRITE CODE BELOW THIS

let kitten ={
name:"Gilbert",
age:3,
type:"middle east",
}
// WRITE CODE ABOVE THIS

console.log(kitten.name);
Expand Down
2 changes: 2 additions & 0 deletions Week-1/InClass/B-objects-get-set/exercise-4.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ let dog = {

// WRITE CODE BELOW THIS LINE

dog.name = "Rex",
dog.wantsToPlay = true,


// WRITE CODE ABOVE THIS LINE
Expand Down
4 changes: 4 additions & 0 deletions Week-1/InClass/C-more-complex-objects/exercise-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ let house = {
WRITE YOUR CODE BELOW
*/

house.address = '51 Berkley Road';
house.previousOwners = ["Brian M.", " Fiona S."];
house.currentOwner.lastName = "Montgomery";

// - change the address of "house" to '51 Berkley Road'
// - change the previous owners of "house" to ["Brian M.", "Fiona S."]
// - change the last name of the current owner of "house" to "Montgomery"
Expand Down
4 changes: 4 additions & 0 deletions Week-1/InClass/C-more-complex-objects/exercise-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ let newCurrentOwner = {
WRITE YOUR CODE BELOW
*/

house.currentOwner = newCurrentOwner;
house.previousOwners[1] = " Stephen B.";
house.isForSale = false;

// - assign the value of the variable 'newCurrentOwner' as the value to the house's "currentOwner"
// - from the list of previous owners, replace only "John A." with "Stephen B."
// - give the house a new property called 'isForSale' with the value 'false'
Expand Down
24 changes: 14 additions & 10 deletions Week-1/InClass/C-more-complex-objects/exercise-3.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ let kinningParkHouse = {
address: "1 Kinning Park",
price: 180000,
currentOwner: {
firstName: "Margaret",
lastName: "Conway",
email: "margaret@fake-emails.com"
firstName: "Margaret",
lastName: "Conway",
email: "margaret@fake-emails.com"
}
};

let parkAvenueHouse = {
address: "50 Park Avenue",
price: 195000,
currentOwner: {
firstName: "Marie",
lastName: "McDonald",
email: "marie.m@real-emails.com"
firstName: "Marie",
lastName: "McDonald",
email: "marie.m@real-emails.com"
}
};

Expand All @@ -29,20 +29,24 @@ let parkAvenueHouse = {

WRITE YOUR CODE BELOW
*/

//let house =[kinningParkHouse, kinningParkHouse];
// returns the full name (first name + last name) of the owner of the house
function getOwnerFullName(house) {

return `${house.currentOwner.firstName} ${house.currentOwner.lastName}`;
}

// returns an array of the owners' email addresses of the two houses
function getEmailAddresses(house1, house2) {

return [house1.currentOwner.email, house2.currentOwner.email];
}

// returns the address for the cheapest house out of the two
function getCheapestAddress(house1, house2) {

if (house1.price < house2.price) {
return house1.address;
} else {
return house2.address;
}
}


Expand Down
5 changes: 4 additions & 1 deletion Week-1/InClass/D-methods/exercise-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ Add a method "greet" so this person can say hello.

let person = {
name: "Alice",
age: 25
age: 25,
greet: function () {
return "Hello everybody";
},
};


Expand Down
5 changes: 4 additions & 1 deletion Week-1/InClass/D-methods/exercise-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ Hint: use 'this' keyword to access the name property.

let person = {
name: "Alice",
age: 25
age: 25,
sayName: function () {
return `May name is ${this.name}`
}
};


Expand Down
Loading