Created
May 3, 2023 18:20
-
-
Save kironroy/a95e3853ab796702cd07b374d24b624e to your computer and use it in GitHub Desktop.
JavaScript objects
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
console.log(vini.getSummary()); | |
const grace = { | |
firstName: 'Grace', | |
lastName: 'Kelly', | |
birthYear: 1945, | |
job: 'Actor', | |
sisters: ['Pam', 'Bonnie', 'Michelle'], | |
hasDriversLicense : true, | |
calcAge: function () { | |
this.age = 2037 - this.birthYear; | |
return this.age; | |
}, | |
getSummary: function() { | |
return `${this.firstName} ${this.lastName} is a ${this.calcAge()}-year old ${vini.job}, and she has ${this.hasDriversLicense ? 'a' : 'no'} driver's license.` | |
} | |
}; | |
console.log(grace.getSummary()); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment