From 6129a5ed06df99c40c5b210b8aa40c94bedfbc1b Mon Sep 17 00:00:00 2001 From: rapraquion Date: Sun, 13 Oct 2019 23:27:40 -0400 Subject: [PATCH] submission --- practice.js | 70 ++++++++++++++++++++++++++++++++++++++++------------- user.json | 4 +-- 2 files changed, 55 insertions(+), 19 deletions(-) diff --git a/practice.js b/practice.js index 82a0b55..775813e 100644 --- a/practice.js +++ b/practice.js @@ -15,7 +15,8 @@ */ //Code here - +let me = { name: "Rap", age: 28 }; +alert(me.name); ////////// PROBLEM 2 ////////// /* @@ -27,21 +28,30 @@ */ // Code here - +let favoriteThings = { + band: "Cradle of Filth", + food: "Beef", + person: "Ghandi", + book: "Javascript for Dummies", + movie: "3 Idiots", + holiday: "Christmas Day" +}; /* 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 = "Bugatti"; +favoriteThings.brand = "Veyron"; /* 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"; +favoriteThings.book = "Harry Potter"; ////////// PROBLEM 3 ////////// /* @@ -53,13 +63,16 @@ */ //Code here - +let backPack = {}; +var item = "firstPocket"; +backPack[item] = "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,17 +80,17 @@ 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. var user2 = { - name: 'Aodhan', + name: "Aodhan", age: 28, - pwHash: 'U+Ldlngx2BYQk', - email: 'aodhan.hayter@gmail.com', - birthday: '11/03/1990', - username: 'aodhan.hayter', + pwHash: "U+Ldlngx2BYQk", + email: "aodhan.hayter@gmail.com", + birthday: "11/03/1990", + username: "aodhan.hayter" }; // Do not edit the code above. @@ -88,7 +101,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,20 +113,27 @@ var user2 = { */ //Code Here - +let methodCollection = { + alertHello: function() { + alert("hello"); + }, + logHello: function() { + console.log("hello"); + } +}; /* 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. */ //Code Here - +methodCollection.alertHello(); /* Now call your alertHello and logHello methods. */ //Code Here - +methodCollection.logHello(); ////////// PROBLEM 6 ////////// /* @@ -121,7 +142,14 @@ var user2 = { */ //Code Here - +function makePerson(name_n, birthday_n, ssn_n) { + let x = { + name: name_n, + birthday: birthday_n, + ssn: ssn_n + }; + return x; +} ////////// PROBLEM 7 ////////// /* @@ -130,3 +158,11 @@ var user2 = { */ //Code Here +function makeCard(cardNumber, expirationDate, securityCode) { + let x = { + card_Number: cardNumber, + expiration_Date: expirationDate, + security_Code: securityCode + }; + return x; +} diff --git a/user.json b/user.json index 4ac80a0..f01ef9d 100644 --- a/user.json +++ b/user.json @@ -1,4 +1,4 @@ { - "name": "", - "email": "" + "name": "Raphael Raquion", + "email": "raphael.raquion@boom.camp" }