diff --git a/practice.js b/practice.js index 82a0b55..5fda253 100644 --- a/practice.js +++ b/practice.js @@ -16,6 +16,11 @@ //Code here +var me = new Object(); +me.name = 'Christian'; +me.age = 22; + + ////////// PROBLEM 2 ////////// /* @@ -28,6 +33,16 @@ // Code here +var favoriteThings = { + band: 'Silent', + food: 'Chicken', + person: 'Browny', + book: 'Water', + movie: 'Fire', + holiday: 'Edsa' +} + + /* 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. @@ -35,6 +50,9 @@ //Code here +favoriteThings.car = 'Supra'; +favoriteThings.brand = 'Toyota'; + /* 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'. @@ -42,6 +60,9 @@ //Code here +favoriteThings.food = 'Chicken Nuggets'; +favoriteThings.book = 'Harry Potter'; + ////////// PROBLEM 3 ////////// /* @@ -54,12 +75,22 @@ //Code here +var backPack = new Object(); +var item = 'firstPocket'; + +backPack['firstPocket'] = 'chapstick'; +backPack.color = 'green'; + + + /* 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. @@ -68,6 +99,8 @@ 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. @@ -89,6 +122,9 @@ 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 //////////////// @@ -100,6 +136,8 @@ var user2 = { //Code Here +var methodCollection = new Object(); + /* Now add two methods (functions that are properties on objects) to your methodCollection object. One called 'alertHello' which alerts 'hello' and another method called 'logHello' which logs 'hello' to the console. @@ -107,12 +145,22 @@ var user2 = { //Code Here +methodCollection.alertHello = function(){ + alert('hello') +}; +methodCollection.logHello = function(){ + console.log('hello') +}; + /* Now call your alertHello and logHello methods. */ //Code Here +methodCollection.alertHello(); +methodCollection.logHello(); + ////////// PROBLEM 6 ////////// /* @@ -122,6 +170,12 @@ var user2 = { //Code Here +function makePerson(name,birthday,ssn){ + return{ + name,birthday,ssn + } +} + ////////// PROBLEM 7 ////////// /* @@ -130,3 +184,12 @@ var user2 = { */ //Code Here + +function makeCard(cardNumber,expirationDate,securityCode){ + return{ + cardNumber, + expirationDate, + securityCode + } + +} \ No newline at end of file diff --git a/user.json b/user.json index 4ac80a0..199a4f1 100644 --- a/user.json +++ b/user.json @@ -1,4 +1,4 @@ { - "name": "", - "email": "" + "name": "Christian Ray Frecia", + "email": "christian.frecia@boom.camp" }