Skip to content

Instantly share code, notes, and snippets.

@pads
Created July 11, 2020 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pads/cb65f212604aad3fb99d25830a96b6f7 to your computer and use it in GitHub Desktop.
Save pads/cb65f212604aad3fb99d25830a96b6f7 to your computer and use it in GitHub Desktop.
//https://github.com/CodeYourFuture/JavaScript-Core-2-Homework/blob/master/Week-1/InClass/C-more-complex-objects/exercise-1.js
/*
Given the following house - follow the instructions below.
Make sure you run the file after and it outputs the correct results.
*/
let house = {
address: "1 Kinning Park",
previousOwners: ["Claire M.", "John A."],
currentOwner: {
firstName: "Margaret",
lastName: "Conway",
},
};
// /*
// DO NOT EDIT ANYTHING ABOVE THIS LINE
// WRITE YOUR CODE BELOW
// */
house.address = '51 Berkley Road';
house.previousOwners = ["Brian M.", "Fiona S."];
house.currentOwner.lastName = "Montgomery"
// - change the address of "house" to '51 Berkley Road'
// - change the previous owners of "house" to ["Brian M.", "Fiona S."]
// - change the last name of the current owner of "house" to "Montgomery"
// /*
// DO NOT EDIT ANYTHING BELOW THIS LINE
// */
console.log(
`Expected result: 51 Berkley Road. Actual result: ${house.address}`
);
console.log(
`Expected result: Brian M., Fiona S. Actual result: ${house.previousOwners.toString()}`
);
console.log(
`Expected result: Montgomery. Actual result: ${house.currentOwner.lastName}`
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment