Created
October 6, 2019 08:35
-
-
Save angelique-w/62cc92c355896adbd272a7459d853cbf 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
class Person { | |
constructor(name, age) { | |
this.name = name; | |
this.age = age; | |
} | |
tellMyName() { | |
return `I am ${this.name}`; | |
} | |
tellMyAge() { | |
return `I am ${this.age} years old`; | |
} | |
} | |
const john = new Person('John', 40); | |
console.log(john.tellMyName()); | |
console.log(john.tellMyAge()); | |
const mary = new Person('Mary', 35); | |
console.log(mary.tellMyName()); | |
console.log(mary.tellMyAge()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment