Skip to content

Commit 9dd921e

Browse files
committed
Finished objects.js Challenges, working on Stretch
1 parent 42e50a4 commit 9dd921e

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

assignments/objects.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,21 @@ console.log(`Keven's email: ${keven.email}`);
6868
console.log(`Gannie's name: ${gannie.name}`);
6969
// Antonietta's Gender
7070
console.log(`Antonietta's gender: ${antonietta.gender}`);
71+
72+
7173
// ==== Challenge 3: Object Methods ====
7274
// Give Kennan the ability to say "Hello, my name is Kennan!" Use the console.log provided as a hint.
7375
// console.log(kennan.speak());
7476

77+
kennan.speak = (phrase) => phrase = "Hello, my name is Kennan!";
78+
console.log(kennan.speak());
79+
7580
// Antonietta loves math, give her the ability to multiply two numbers together and return the product. Use the console.log provided as a hint.
7681
//console.log(antonietta.multiplyNums(3,4));
7782

83+
antonietta.multiplyNums = (num1, num2) => num1 * num2;
84+
console.log(antonietta.multiplyNums(3,4));
85+
7886
// === Great work! === Head over to the the arrays.js file or take a look at the stretch challenge
7987

8088
// ==== Stretch Challenge: Nested Objects and the this keyword ====
@@ -84,7 +92,10 @@ console.log(`Antonietta's gender: ${antonietta.gender}`);
8492
// 3. Nest a grandchild object in the child object with properties for name and age. The name will be Sam and the age will be 30
8593
// 4. Give each of the objects the ability to speak their names using the this keyword.
8694

87-
const parent = {}
95+
const parent = {
96+
"name": "Susan",
97+
"age": "70"
98+
}
8899

89100
// Log the parent object's name
90101

0 commit comments

Comments
 (0)