Accessing values from nested objects and assigning to a variable


  Fluffy has two friends, Grumpy and Lazy Bones. 

    1. Assign the value of Grumpy's 2nd activity to the grumpyActivity variable below.

    2. Assign fluffy2ndFriend the name of Fluffy's 2nd friend.


//Code Here

var grumpyActivity = cat.catFriends[0].activities[1];

var fluffy2ndFriend = cat.catFriends[1];

I’m almost done with this one, but how would I for fluffly2ndFriend only access the name ‘Lazy Bones’ I’m failing due to it including his activities as well

Hey there,

I’ve edited your post for readability, because it was very hard to read.

You can use the “preformatted text” tool in the editor ( </> ) to add code.

In the future, please use the Get Help button in a lesson to create a forum topic and fill in the questions.


Thanks for understanding! :slightly_smiling_face:

You are currently in the second friend of the cat.
Now you have to use the property for the name, like you did in the first line for the activities. activities seems to be an array, a name isn’t, so you probably don’t have to use the brackets.