Manipulating Objects
Learning Competencies
- Define local variables in JavaScript
- Create, add properties to, delete properties from, and access values from JavaScript Object literals
- Use pre-written tests to drive development
Time Box
| Activity | Time |
|---|---|
| Kata | 1.5 hours |
| Reflect | 10 minutes |
Summary
In this challenge, you will work with the following JavaScript object that has been assigned to the variable terah. You will have to complete each task without modifying the object itself. That means everything must be done outside of the curly braces.
const terah = {name: "Terah",age: 32,height: 172,hairColor: "brown",eyeColor: "brown",};
There is some jargon used in this kata, so here's a quick recap of an object's anatomy:

Pass the Tests
The steps below match the order of the tests you will need to complete. After completing each step, run your code to ensure that the next test passes.
Note that each step below should be its own line of code in sequential order (i.e. each step will build on any of your code before it).
Define a variable
adamand use object literal notation to assign this variable the value of an object with no properties.Give the
adamobject a name key that has the value "Adam".Add a spouse key to
terahand assign it the value ofadam.Change the value of the
terahage property to 33.Remove the eyeColor property from
terah(hint: use thedeleteoperator).Add a spouse key to the
adamobject and assign it the value ofterah.Add a children key to
terahand use object literal notation to assign this variable to an empty object.Add a
benproperty to the value of theterahchildren property.benshould be an object with the keynameand the value "Ben".Add a
wilsonproperty to the value of theterahchildren property.wilsonshould be an object with the keynamewith the value "Wilson".Add a
feliciaproperty to the value of theterahchildren property.feliciashould be an object with the keynamewith the value "Felicia".Add a children property to
adamand assign it the value ofterah.children.
Your final terah object will be logged to the console when all the tests have passed.