diff --git a/practice.js b/practice.js index 82a0b55..3b95718 100644 --- a/practice.js +++ b/practice.js @@ -15,7 +15,11 @@ */ //Code here - +let me = { + name: 'Lyza Mae Mirabete', + age: 21 +} +console.log(me.name); ////////// PROBLEM 2 ////////// /* @@ -27,21 +31,29 @@ */ // Code here - +let favoriteThings = { + band: 'Westlife', + food: 'Sisig', + person: 'Reymark', + book: 'Harry Potter', + movie: 'Jowable', + holiday: 'Christmas' +} /* After you've made your object, use bracket or dot notation to add another key named 'car' with the value being your favorite car and then another key named 'brand' with the value being your favorite brand. */ //Code here - +favoriteThings.car = 'Mustang'; +favoriteThings.brand = 'Ford' /* Now use bracket or dot notation to change the value of the food key in your favoriteThings object to be 'Chicken Nuggets' and change the value of the book key in your favoriteThings object to be 'Harry Potter'. */ //Code here - +favoriteThings.food = 'Chicken Nuggets' ////////// PROBLEM 3 ////////// /* @@ -53,13 +65,16 @@ */ //Code here - +let backPack = {}; +var item = 'firstPocket'; +backPack['firstPocket'] = 'chapstick'; +backPack.color = 'Black'; /* After you do the above, alert your entire backPack object. */ //Code here - +// alert(backPack); /* You probably noticed that it just alerted [object Object]. Alerting to see the data in your Object doesn't work so well. @@ -67,7 +82,7 @@ Instead, console.log your whole backPack object and then check out the console. */ //Code here - +console.log(backPack); ////////// PROBLEM 4 ////////// // Do not edit the code below. @@ -88,7 +103,8 @@ var user2 = { */ //Code Here - +user2.name = 'Aodhan Hayter'; +user2.email = 'aodhan@boom.camp'; /////////////////////// EXTRA PRACTICE PROBLEMS BELOW //////////////////// ////////// MOVE ONTO NEXT SECTION BEFORE WORKING ON THESE //////////////// @@ -99,6 +115,7 @@ var user2 = { */ //Code Here +let methodCollection = {}; /* Now add two methods (functions that are properties on objects) to your methodCollection object. @@ -106,12 +123,21 @@ var user2 = { */ //Code Here - +methodCollection = { + alertHello() { + alert('hello'); + }, + logHello() { + console.log('hello'); + } +}; /* Now call your alertHello and logHello methods. */ //Code Here +methodCollection.alertHello(); +methodCollection.logHello(); ////////// PROBLEM 6 ////////// @@ -121,7 +147,13 @@ var user2 = { */ //Code Here - +function makePerson(){ + return{ + name: "Tester", + birthday: "Nov 1", + ssn: "123456789" +} +} ////////// PROBLEM 7 ////////// /* @@ -130,3 +162,10 @@ var user2 = { */ //Code Here +function makeCard(){ + return{ + cardNumber: "132413", + expirationDate: "Dec 1, 2020", + securityCode: 1234 + } +} \ No newline at end of file diff --git a/user.json b/user.json index 4ac80a0..c1982a8 100644 --- a/user.json +++ b/user.json @@ -1,4 +1,4 @@ { - "name": "", - "email": "" + "name": "Lyza Mae B. Mirabete", + "email": "lyza.mirabete@boom.camp" }