Skip to content

Instantly share code, notes, and snippets.

@angelique-w
Created October 6, 2019 08:35
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 angelique-w/62cc92c355896adbd272a7459d853cbf to your computer and use it in GitHub Desktop.
Save angelique-w/62cc92c355896adbd272a7459d853cbf to your computer and use it in GitHub Desktop.
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