Created
July 11, 2020 15:53
-
-
Save pads/84105c1083d64edf41a46525665a8f5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/CodeYourFuture/JavaScript-Core-2-Homework/blob/master/Week-1/InClass/D-methods/exercise-3.js | |
/* | |
The following code contains syntax errors - try and fix them! | |
Once you fix them, run this file, it should output the correct values! | |
*/ | |
let person = { | |
name: "Alice", | |
age: 25, | |
currentAddress: "Glasgow", | |
changeAddress: function(newAddress) { | |
this.currentAddress = newAddress; | |
}, | |
celebrateBirthday: function() { | |
this.age = this.age + 1; | |
} | |
}; | |
/* | |
DO NOT EDIT ANYTHING BELOW THIS LINE | |
*/ | |
person.changeAddress("Edinburgh"); | |
console.log(`Expected result: Edinburgh. Actual result: ${person.currentAddress}`); | |
person.celebrateBirthday(); | |
console.log(`Expected result: 26. Actual result: ${person.age}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment