 // Manipulating JavaScript Objects

// I worked on this challenge: [by myself, with: ]

// There is a section below where you will write your code.

// DO NOT ALTER THIS OBJECT BY ADDING ANYTHING WITHIN THE CURLY BRACES!
var terah = {
  name: "Terah",
  age: 32,
  height: 66,
  weight: 130,
  hairColor: "brown",
  eyeColor: "brown"
}
// __________________________________________
// Write your code below.











// __________________________________________
// Reflection: Use the reflection guidelines
//
//
//
//
//
//


// __________________________________________
// Driver Code:  Do not alter code below this line.
function assert(test, message, test_number) {
  if (!test) {
    console.log(test_number + "false");
    throw "ERROR: " + message;
  }
  console.log(test_number + "true");
  return true;
}

assert(
  (adam instanceof Object),
  "The value of adam should be an Object.",
  "1. "
)

assert(
  (adam.name === "Adam"),
  "The value of the adam name property should be 'Adam'.",
  "2. "
)

assert(
  terah.spouse === adam,
  "terah should have a spouse property with the value of the object adam.",
  "3. "
)

assert(
  terah.weight === 125,
  "The terah weight property should be 125.",
  "4. "
)

assert(
  terah.eyeColor === undefined || null,
  "The terah eyeColor property should be deleted.",
  "5. "
)

assert(
  terah.spouse.spouse === terah,
  "Terah's spouse's spouse property should refer back to the terah object.",
  "6. "
)

assert(
  (terah.children instanceof Object),
  "The value of the terah children property should be defined as an Object.",
  "7. "
)

assert(
  (terah.children.carson instanceof Object),
  "carson should be defined as an object and assigned as a child of Terah",
  "8. "
  )

assert(
  terah.children.carson.name === "Carson",
  "Terah's children should include an object called carson which has a name property equal to 'Carson'.",
  "9. "
)

assert(
  (terah.children.carter instanceof Object),
  "carter should be defined as an object and assigned as a child of Terah",
  "10. "
  )

assert(
  terah.children.carter.name === "Carter",
  "Terah's children should include an object called carter which has a name property equal to 'Carter'.",
  "11. "
)

assert(
  (terah.children.colton instanceof Object),
  "colton should be defined as an object and assigned as a child of Terah",
  "12. "
  )

assert(
  terah.children.colton.name === "Colton",
  "Terah's children should include an object called colton which has a name property equal to 'Colton'.",
  "13. "
)

assert(
  adam.children === terah.children,
  "The value of the adam children property should be equal to the value of the terah children property",
  "14. "
)

console.log("\nHere is your final terah object:")
console.log(terah)
@@ -403,22 +403,466 @@
 below.%0A%0A
-%0A%0A%0A%0A%0A%0A
+var adam = %7B%0A  name: %22Adam%22,%0A%7D;%0A%0Avar carson = %7B%0A  name: %22Carson%22,%0A%7D;%0A%0Avar carter = %7B%0A  name: %22Carter%22,%0A%7D;%0A%0Avar colson = %7B%0A  name: %22Colson%22,%0A%7D;%0A%0Avar colton = %7B%0A  name: %22Colton%22,%0A%7D;%0A%0A%0Aterah.spouse = adam;%0Aterah.weight = 125;%0Adelete terah.eyeColor;%0A%0Aadam.spouse = terah;%0A%0Aterah.children = %7B%7D;%0Aterah.children.carson = carson;%0Aterah.children.carter = carter;%0Aterah.children.colson = colson;%0Aterah.children.colton = colton;%0A%0Aadam.children = terah.children;
 %0A%0A%0A%0A// _

Complete coding challenge for 7.4 manipulating_objects.js