diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a0de46f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5504 +} \ No newline at end of file diff --git a/Week-1/Homework/mandatory/1-writers.js b/Week-1/Homework/mandatory/1-writers.js index 82acf6f..4699532 100644 --- a/Week-1/Homework/mandatory/1-writers.js +++ b/Week-1/Homework/mandatory/1-writers.js @@ -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.`) + } +} \ No newline at end of file diff --git a/Week-1/Homework/mandatory/2-water-bottle.js b/Week-1/Homework/mandatory/2-water-bottle.js index 981d7e3..2877636 100644 --- a/Week-1/Homework/mandatory/2-water-bottle.js +++ b/Week-1/Homework/mandatory/2-water-bottle.js @@ -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 - } }; /* diff --git a/Week-1/Homework/mandatory/3-groceries.js b/Week-1/Homework/mandatory/3-groceries.js index 2b34cdb..8070d93 100644 --- a/Week-1/Homework/mandatory/3-groceries.js +++ b/Week-1/Homework/mandatory/3-groceries.js @@ -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); \ No newline at end of file diff --git a/Week-1/Homework/projects/1-recipes.js b/Week-1/Homework/projects/1-recipes.js index 3ada67c..9c76391 100644 --- a/Week-1/Homework/projects/1-recipes.js +++ b/Week-1/Homework/projects/1-recipes.js @@ -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); diff --git a/Week-1/Homework/projects/2-reading-list.js b/Week-1/Homework/projects/2-reading-list.js index 939e3e2..824c530 100644 --- a/Week-1/Homework/projects/2-reading-list.js +++ b/Week-1/Homework/projects/2-reading-list.js @@ -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: @@ -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 = []; diff --git a/Week-1/InClass/A-objects-intro/exercise-part-0.js b/Week-1/InClass/A-objects-intro/exercise-part-0.js index 433d27c..5309b2b 100644 --- a/Week-1/InClass/A-objects-intro/exercise-part-0.js +++ b/Week-1/InClass/A-objects-intro/exercise-part-0.js @@ -4,4 +4,13 @@ Describe your own laptop as a JavaScript object Try to think of as many properties as you can! -*/ \ No newline at end of file +*/ + +let myLaptop = { + brand: "MacBook", + screenSize: 13, + hardDisc: 128, + microChip: "8 Gen I5", + operatingSystem: "MacOs", + RAM: 8, +} \ No newline at end of file diff --git a/Week-1/InClass/A-objects-intro/exercise-part-1.js b/Week-1/InClass/A-objects-intro/exercise-part-1.js index 49e1ed9..1f01cf9 100644 --- a/Week-1/InClass/A-objects-intro/exercise-part-1.js +++ b/Week-1/InClass/A-objects-intro/exercise-part-1.js @@ -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, +} \ No newline at end of file diff --git a/Week-1/InClass/A-objects-intro/exercise-part-2.js b/Week-1/InClass/A-objects-intro/exercise-part-2.js index 4e01403..3a8b108 100644 --- a/Week-1/InClass/A-objects-intro/exercise-part-2.js +++ b/Week-1/InClass/A-objects-intro/exercise-part-2.js @@ -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" \ No newline at end of file + megapixels: 12, + batteryLife: "24 hours", +} \ No newline at end of file diff --git a/Week-1/InClass/B-objects-get-set/exercise-1.js b/Week-1/InClass/B-objects-get-set/exercise-1.js index 6591384..d3842a3 100644 --- a/Week-1/InClass/B-objects-get-set/exercise-1.js +++ b/Week-1/InClass/B-objects-get-set/exercise-1.js @@ -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"]); diff --git a/Week-1/InClass/B-objects-get-set/exercise-2.js b/Week-1/InClass/B-objects-get-set/exercise-2.js index c8b5e7b..96bb8a5 100644 --- a/Week-1/InClass/B-objects-get-set/exercise-2.js +++ b/Week-1/InClass/B-objects-get-set/exercise-2.js @@ -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 diff --git a/Week-1/InClass/B-objects-get-set/exercise-3.js b/Week-1/InClass/B-objects-get-set/exercise-3.js index f775c9a..176f4da 100644 --- a/Week-1/InClass/B-objects-get-set/exercise-3.js +++ b/Week-1/InClass/B-objects-get-set/exercise-3.js @@ -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); diff --git a/Week-1/InClass/B-objects-get-set/exercise-4.js b/Week-1/InClass/B-objects-get-set/exercise-4.js index 763347e..e9681a6 100644 --- a/Week-1/InClass/B-objects-get-set/exercise-4.js +++ b/Week-1/InClass/B-objects-get-set/exercise-4.js @@ -9,6 +9,8 @@ let dog = { // WRITE CODE BELOW THIS LINE +dog.name = "Rex", +dog.wantsToPlay = true, // WRITE CODE ABOVE THIS LINE diff --git a/Week-1/InClass/C-more-complex-objects/exercise-1.js b/Week-1/InClass/C-more-complex-objects/exercise-1.js index 8ae3e82..6cf5caa 100644 --- a/Week-1/InClass/C-more-complex-objects/exercise-1.js +++ b/Week-1/InClass/C-more-complex-objects/exercise-1.js @@ -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" diff --git a/Week-1/InClass/C-more-complex-objects/exercise-2.js b/Week-1/InClass/C-more-complex-objects/exercise-2.js index 7ea0200..339bda4 100644 --- a/Week-1/InClass/C-more-complex-objects/exercise-2.js +++ b/Week-1/InClass/C-more-complex-objects/exercise-2.js @@ -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' diff --git a/Week-1/InClass/C-more-complex-objects/exercise-3.js b/Week-1/InClass/C-more-complex-objects/exercise-3.js index 4bfbfd3..e420f8f 100644 --- a/Week-1/InClass/C-more-complex-objects/exercise-3.js +++ b/Week-1/InClass/C-more-complex-objects/exercise-3.js @@ -8,9 +8,9 @@ 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" } }; @@ -18,9 +18,9 @@ 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" } }; @@ -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; + } } diff --git a/Week-1/InClass/D-methods/exercise-1.js b/Week-1/InClass/D-methods/exercise-1.js index 8de0f8c..f164891 100644 --- a/Week-1/InClass/D-methods/exercise-1.js +++ b/Week-1/InClass/D-methods/exercise-1.js @@ -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"; + }, }; diff --git a/Week-1/InClass/D-methods/exercise-2.js b/Week-1/InClass/D-methods/exercise-2.js index 8e993fc..7eb776f 100644 --- a/Week-1/InClass/D-methods/exercise-2.js +++ b/Week-1/InClass/D-methods/exercise-2.js @@ -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}` + } }; diff --git a/Week-1/InClass/D-methods/exercise-3.js b/Week-1/InClass/D-methods/exercise-3.js index be23748..09029bb 100644 --- a/Week-1/InClass/D-methods/exercise-3.js +++ b/Week-1/InClass/D-methods/exercise-3.js @@ -8,11 +8,11 @@ let person = { name: "Alice", age: 25, currentAddress: "Glasgow", - changeAddress: (newAddress) { - currentAddress = newAddress; + changeAddress: function (newAddress) { + this.currentAddress = newAddress; }, - celebrateBirthday: function { - that.age = that.age + 1; + celebrateBirthday: function () { + this.age = this.age + 1; } }; diff --git a/Week-1/InClass/D-methods/exercise-4.js b/Week-1/InClass/D-methods/exercise-4.js index d89214a..a7cae37 100644 --- a/Week-1/InClass/D-methods/exercise-4.js +++ b/Week-1/InClass/D-methods/exercise-4.js @@ -6,7 +6,10 @@ Define a method "makeFriend" to add a new friend to her list. let person = { name: "Alice", - friends: ["John", "Nina"] + friends: ["John", "Nina"], + makeFriend: function(friend) { + this.friends.push(friend); + } }; diff --git a/Week-1/InClass/D-methods/exercise-5.js b/Week-1/InClass/D-methods/exercise-5.js index dcd198c..2ff8b0f 100644 --- a/Week-1/InClass/D-methods/exercise-5.js +++ b/Week-1/InClass/D-methods/exercise-5.js @@ -16,11 +16,22 @@ let coffeeMachine = { flatWhite: 3.00 }, insertedAmount: 0, - insertMoney: function (amount) { + insertMoney: function (amount) { + return this.insertedAmount += amount; }, - getCoffee: function (coffee) { + getCoffee: function (coffee) { + if (this.insertedAmount && coffee === 'flatWhite' >= 3.00) { + return `Please take your ${coffee}`; + } else if (this.insertedAmount >= 2.40 && coffee === 'cappuccino') { + return `Please take your ${coffee}`; + } else if (this.insertedAmount >= 1.50 && coffee === 'blackCoffee') { + return `Please take your ${coffee}`; + } + else { + return `Sorry you don't have enough money for ${coffee}`; + } } }; @@ -39,5 +50,4 @@ coffeeMachine.insertMoney(4.00); console.log(`Expected result: 'Please take your flatWhite'. Actual result: ${coffeeMachine.getCoffee('flatWhite')}`); coffeeMachine.insertMoney(2.40); -console.log(`Expected result: 'Sorry you don't have enough money for a flatWhite'. Actual result: ${coffeeMachine.getCoffee('flatWhite')}`); - +console.log(`Expected result: 'Sorry you don't have enough money for a flatWhite'. Actual result: ${coffeeMachine.getCoffee('flatWhite')}`); \ No newline at end of file diff --git a/Week-1/InClass/E-arrays-of-objects/exercise-1.js b/Week-1/InClass/E-arrays-of-objects/exercise-1.js index 8d39a81..0d0dc85 100644 --- a/Week-1/InClass/E-arrays-of-objects/exercise-1.js +++ b/Week-1/InClass/E-arrays-of-objects/exercise-1.js @@ -24,23 +24,32 @@ DO NOT EDIT ANYTHING ABOVE THIS LINE WRITE YOUR CODE BELOW */ +var persons = [person1, person2, person3]; // Complete here -var persons = // Complete here +function getPersonNames (person){ + return person.name; +} -var personNames = // Complete here +function youngerThan28Years (person){ + return person.age < 28; +} -var personsYoungerThan28YearsOld = // Complete here +var personNames = persons.map(getPersonNames); +// var personNames = persons.map(person => person.name); // Complete here + +var personsYoungerThan28YearsOld = persons.filter(youngerThan28Years); + // var personsYoungerThan28YearsOld = persons.filter(person => person.age < 28); // Complete here /* DO NOT EDIT ANYTHING BELOW THIS LINE */ -console.log("Question 1: array defined with 3 persons -> ", +console.log("Question 1: array defined with 3 persons -> ", (persons[0] === person1 && persons[1] === person2 && persons[2] === person3) ? 'Passed :)' : 'Not yet :('); -console.log("Question 2: array containing the person names -> ", +console.log("Question 2: array containing the person names -> ", (personNames[0] === "Alice" && personNames[1] === "Bob" && personNames[2] === "John") ? 'Passed :)' : 'Not yet :('); -console.log("Question 3: array containing the persons younger than 28 years old -> ", - (personsYoungerThan28YearsOld[0] === person1 && personsYoungerThan28YearsOld[1] === person3) ? 'Passed :)' : 'Not yet :('); +console.log("Question 3: array containing the persons younger than 28 years old -> ", + (personsYoungerThan28YearsOld[0] === person1 && personsYoungerThan28YearsOld[1] === person3) ? 'Passed :)' : 'Not yet :('); \ No newline at end of file diff --git a/Week-1/InClass/E-arrays-of-objects/exercise-2.js b/Week-1/InClass/E-arrays-of-objects/exercise-2.js index c2259dd..ba78c09 100644 --- a/Week-1/InClass/E-arrays-of-objects/exercise-2.js +++ b/Week-1/InClass/E-arrays-of-objects/exercise-2.js @@ -39,12 +39,27 @@ DO NOT EDIT ANYTHING ABOVE THIS LINE WRITE YOUR CODE BELOW */ +function destinationNames(destination) { + return destination.destinationName; +} -let destinationNamesWithin500Kms = // Complete here +function destinationInside500(destination) { + return destination.distanceKms <= 500; +} -let destinationNameReachableByFerry = // Complete here +function destinationTransportationWithFerry(destination) { + return destination.transportations.includes("ferry"); +} -let destinationNamesMoreThan300KmsAwayByTrain = // Complete here (PRINT THE RESULT IN THE CONSOLE USING FOREACH) +function destinationMoreThan300AndWithTrain(destination) { + return destination.distanceKms > 300 && destination.transportations.includes("train"); +} + +let destinationNamesWithin500Kms = travelDestinations.filter(destinationInside500).map(destinationNames); // Complete here + +let destinationNameReachableByFerry = travelDestinations.filter(destinationTransportationWithFerry).map(destinationNames); // Complete here + +let destinationNamesMoreThan300KmsAwayByTrain = travelDestinations.filter(destinationMoreThan300AndWithTrain).map(destinationNames); // Complete here (PRINT THE RESULT IN THE CONSOLE USING FOREACH) /* @@ -53,4 +68,4 @@ DO NOT EDIT ANYTHING BELOW THIS LINE console.log(`Question 1) Expected result: Edinburgh,Dublin, actual result: ${destinationNamesWithin500Kms}`); console.log(`Question 2) Expected result: Dublin, actual result: ${destinationNameReachableByFerry}`); -console.log(`Question 3) Expected result: London,Paris, actual result: ${destinationNamesMoreThan300KmsAwayByTrain}`); +console.log(`Question 3) Expected result: London,Paris, actual result: ${destinationNamesMoreThan300KmsAwayByTrain}`); \ No newline at end of file diff --git a/Week-1/InClass/E-arrays-of-objects/exercise-3.js b/Week-1/InClass/E-arrays-of-objects/exercise-3.js index a1ec691..c2885cc 100644 --- a/Week-1/InClass/E-arrays-of-objects/exercise-3.js +++ b/Week-1/InClass/E-arrays-of-objects/exercise-3.js @@ -59,17 +59,47 @@ let restaurantFinderApplication = { applicationName: "Restaurant Finder", applicationVersion: "1.0", restaurants: restaurants, - findAvailableRestaurants: function (numberOfPeople) { - // Complete here + + findAvailableRestaurants: function(numberOfPeople) { // Complete here + let namesOfRestaurants = ""; + restaurants.forEach(restaurant => { + if(numberOfPeople <= restaurant.totalSeats - restaurant.numberOfCustomers){ + namesOfRestaurants += restaurant.name + "," + } + }) + return namesOfRestaurants; }, - findRestaurantServingDish: function (dishName) { - // Complete here + + findRestaurantServingDish: function (dishName) { // Complete here + return this.restaurants.filter(restaurant => restaurant.menu.includes(dishName)).map(restaurant => restaurant.name); }, - countNumberOfRestaurantsInArea: function (area) { - // Complete here + + /* findRestaurantServingDish: function(dishName) { // Complete here + let newArr=[]; + restaurants.filter(menu => { + + //newArr = restaurants.includes(dishName); + newArr.push(restaurants.menu.includes(dishName)) + }); + return newArr; + }, */ + +///////// + + countNumberOfRestaurantsInArea: function (area) { // Complete here + return (this.restaurants.filter(restaurant => restaurant.address.area == area)).length; } + +///////// + //countNumberOfRestaurantsInArea: function() { // Complete here + // return this.restaurants.address.includes("area"); + // } + }; +function restaurantNames (restaurant){ + return restaurant.name; +} /* DO NOT EDIT ANYTHING BELOW THIS LINE @@ -82,4 +112,4 @@ let restaurantsServingSalad = restaurantFinderApplication.findRestaurantServingD console.log(`Find restaurants serving salad: Expected result: Paesano,Ubiquitous Chip, actual result: ${restaurantsServingSalad}`); let numberOfRestaurantsInCityCentre = restaurantFinderApplication.countNumberOfRestaurantsInArea("center"); -console.log(`Number of restaurants in city centre: Expected result: 2, actual result: ${numberOfRestaurantsInCityCentre}`); +console.log(`Number of restaurants in city centre: Expected result: 2, actual result: ${numberOfRestaurantsInCityCentre}`); \ No newline at end of file diff --git a/Week-1/InClass/F-object-keys/exercise-part-0.js b/Week-1/InClass/F-object-keys/exercise-part-0.js index d9b1085..6db0195 100644 --- a/Week-1/InClass/F-object-keys/exercise-part-0.js +++ b/Week-1/InClass/F-object-keys/exercise-part-0.js @@ -20,13 +20,13 @@ let highScores = { // ONLY EDIT BELOW HERE -let capitalCitiesKeys = ; -let highScoresKeys; +let capitalCitiesKeys = Object.keys(capitalCities); +let highScoresKeys = Object.keys(highScores); // ONLY EDIT ABOVE HERE console.log(capitalCitiesKeys); // prints [ 'scotland', 'kenya', 'australia', 'canada' ] -console.log(highScoresKeys) +console.log(highScoresKeys); // prints ['34, '55', '89', '100'] diff --git a/Week-1/InClass/F-object-keys/exercise-part-1.js b/Week-1/InClass/F-object-keys/exercise-part-1.js index b8d4be7..7889c4a 100644 --- a/Week-1/InClass/F-object-keys/exercise-part-1.js +++ b/Week-1/InClass/F-object-keys/exercise-part-1.js @@ -15,9 +15,15 @@ let mentorsAges = { // ONLY EDIT BELOW THIS LINE -let mentorsNames = ; +function upperCaseTheNames (name){ + return name.toUpperCase(); +}; + +let mentorsNames = Object.keys(mentorsAges) ; +console.log(mentorsNames); -let mentorsNamedUppercased = ; +let mentorsNamedUppercased = mentorsNames.map(upperCaseTheNames); +console.log(mentorsNamedUppercased); // ONLY EDIT ABOVE THIS LINE diff --git a/Week-1/InClass/F-object-keys/exercise-part-2.js b/Week-1/InClass/F-object-keys/exercise-part-2.js index 6b6a1bb..9b1a1bd 100644 --- a/Week-1/InClass/F-object-keys/exercise-part-2.js +++ b/Week-1/InClass/F-object-keys/exercise-part-2.js @@ -35,14 +35,14 @@ let storeBranches = { // # 1 // prints [ 'glasgow', 'edinburgh' ] -console.log() +console.log(Object.keys(storeBranches)); // # 2 // prints [ 'manager', 'assistant', 'interns' ] -console.log() +console.log(Object.keys(storeBranches.glasgow)); // # 3 // prints [ 'head_intern', 'intern' ] -console.log() +console.log(Object.keys(storeBranches.glasgow.interns)); // ONLY EDIT ABOVE THIS LINE diff --git a/Week-2/Homework/mandatory/2-exercises/exercises.js b/Week-2/Homework/mandatory/2-exercises/exercises.js index 174c5db..3e2849f 100644 --- a/Week-2/Homework/mandatory/2-exercises/exercises.js +++ b/Week-2/Homework/mandatory/2-exercises/exercises.js @@ -12,11 +12,24 @@ *