-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathpractice.js
More file actions
159 lines (96 loc) · 3.52 KB
/
Copy pathpractice.js
File metadata and controls
159 lines (96 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
Once you complete a problem, refresh ./SpecRunner.html in your browser and check to see if the problem's test(s) are passing.
Passed tests will be indicated by a green circle.
Failed tests will be indicated by a red X.
You can refresh the page at any time to re-run all the tests.
IMPORTANT NOTE: use var for declaring variables
*/
////////// PROBLEM 1 //////////
/*
Create an object called me.
Give it a key of name with the value being your name, and another key of age with the value being your age.
Then console log your name using dot notation.
*/
//Code here
////////// PROBLEM 2 //////////
/*
Make a 'favoriteThings' object that contains the following keys:
band, food, person, book, movie, holiday
Have the values to those keys be strings that are equal to your favorite thing in that category.
*/
//Code here
/*
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
/*
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
////////// PROBLEM 3 //////////
/*
Create an empty Object called backPack.
Now, create a variable called 'item' and set it equal to the string 'firstPocket'.
Using bracket notation, add a 'firstPocket' key (or property) to backPack, using 'item'.
Set the value of that key to 'chapstick'.
Using dot notation, add another key (or property) to your backPack object that is named color, with the value being the color of your backpack.
*/
//Code here
/*
After you do the above, try to alert your entire backPack object.
Uncomment the code below and comment it again when you're done.
*/
// alert(backPack);
/*
You probably noticed that it just alerted [object Object].
Alerting to see the data in your Object doesn't work so well.
Instead, console log your whole backPack object and then check out the console.
*/
//Code here
////////// PROBLEM 4 //////////
// Do not edit the code below.
var user2 = {
name: 'Aodhan',
age: 28,
pwHash: 'U+Ldlngx2BYQk',
email: 'aodhan.hayter@gmail.com',
birthday: '11/03/1990',
username: 'aodhan.hayter',
};
// Do not edit the code above.
/*
Let's say I, the user, decided to change my name and email address to the following:
name -> 'Aodhan Hayter' and email -> 'aodhan@boom.camp'.
Make that change without modifying the original object code above.
*/
//Code here
/////////////////////// EXTRA PRACTICE PROBLEMS BELOW ////////////////////
////////// MOVE ONTO NEXT SECTION BEFORE WORKING ON THESE ////////////////
////////// PROBLEM 5 //////////
/*
Create an empty object called methodCollection.
*/
//Code here
/*
Now add a method to your methodCollection object.
Called 'logHello' which logs 'hello' to the console.
*/
//Code here
/*
Now call your logHello method.
*/
//Code here
////////// PROBLEM 6 //////////
/*
Create a function called makePerson which takes in name, birthday, ssn as its parameters.
Return a new object with all of the information that you passed in.
*/
//Code here
////////// PROBLEM 7 //////////
/*
Create a function called makeCard which takes in cardNumber, expirationDate, and securityCode to make a Credit Card object.
Return that object so that whenever you invoke makeCard, you get a brand new credit card.
*/
//Code here