Skip to content

Commit dd261bb

Browse files
committed
objects.js
1 parent 05715f9 commit dd261bb

1 file changed

Lines changed: 43 additions & 8 deletions

File tree

‎assignments/objects.js‎

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,63 @@ const example = {
1818
}
1919

2020
// Write your intern objects here:
21-
21+
const intern1 = {
22+
"id": 1,
23+
"name": "Mitzi",
24+
"email": "mmelloy0@psu.edu",
25+
"gender": "F"
26+
}
27+
const intern2 = {
28+
"id": 2,
29+
"name": "Kennan",
30+
"email": "kdiben1@tinypic.com",
31+
"gender": "M",
32+
speak: function() {
33+
console.log("Hello, my name is Kennan!");
34+
}
35+
}
36+
const intern3 = {
37+
"id": 3,
38+
"name": "Keven",
39+
"email": "kmummery2@wikimedia.org",
40+
"gender": "M"
41+
}
42+
const intern4 = {
43+
"id": 4,
44+
"name": "Gannie",
45+
"email": "gmartinson3@illinois.edu",
46+
"gender": "M"
47+
}
48+
const intern5 = {
49+
"id": 5,
50+
"name": "Antonietta",
51+
"email": "adaine5@samsung.com",
52+
"gender": "F",
53+
multiplyNums: function(num1, num2) {
54+
console.log(num1 * num2);
55+
}
56+
}
2257

2358
// ==== Challenge 2: Reading Object Data ====
2459
// Once your objects are created, log out the following requests from HR into the console:
2560

2661
// Mitzi's name
27-
62+
console.log(intern1["name"]);
2863
// Kennan's ID
29-
64+
console.log(intern2["id"]);
3065
// Keven's email
31-
66+
console.log(intern3["email"]);
3267
// Gannie's name
33-
68+
console.log(intern4["name"]);
3469
// Antonietta's Gender
35-
70+
console.log(intern5["gender"]);
3671
// ==== Challenge 3: Object Methods ====
3772
// Give Kennan the ability to say "Hello, my name is Kennan!" Use the console.log provided as a hint.
3873
// console.log(kennan.speak());
39-
74+
intern2["speak"]();
4075
// Antonietta loves math, give her the ability to multiply two numbers together and return the product. Use the console.log provided as a hint.
4176
//console.log(antonietta.multiplyNums(3,4));
42-
77+
intern5["multiplyNums"](3, 4);
4378
// === Great work! === Head over to the the arrays.js file or take a look at the stretch challenge
4479

4580
// ==== Stretch Challenge: Nested Objects and the this keyword ====

0 commit comments

Comments
 (0)