Exercises: Objects 6 - Nested Objects

About this lesson

An introduction to objects with more complicated properties

Concepts Reviewed:

Object Property Access
Check Your Work
Step 1
Where'd my code go?

Your code is in a separate file for steps 1-5.

You are welcome to copy and paste any objects you created from the previous lessons into this one!

Step 2
Objects Within Objects

We can make a party object which can store the creatures we have been making inside of it.

Temp1524175446 Objects
Step 3
Empty Objects

This is an empty object.
We use these as placeholders for later objects.

Temp1524175564 Temp1530907601
Step 4
Objects within Objects

This is an object which has 6 empty objects inside of it.


Add this code as a basis for your party

Name it what you want your party to be called

Step 5
(25 PTS) Create your own Party!

Use the above party code as a baseline.

replace {} with an inline object: slot1: {HP:10, MaxHP:12, ect..},

or with an object you have already defined: slot2: jamikazam,


You can have any number of slots in your party, but must include at least two creatures and one empty object!

Check Your Work
Step 6
Make sure it all works!

add a console.log( yourParty )
check to make sure the output is similar to the following

Step 7

You may notice that we no longer can see the name of the variable within the object.
You can fix this by adding a Name, Nickname, or any other property you wish to add.

Exercises: Objects 6 - Nested Objects Info


MVCode Clubs

Created By

Missing tiny jake wheaton

Access Level


For Teachers and Schools

Teach coding to your students with MVCode Teach

MVCode offers an integrated product designed to teach coding to students.

Learn more about MVCode Teach