Skip to content

Instantly share code, notes, and snippets.

@GuillaumeLoup
Created March 17, 2019 09:19
Show Gist options
  • Save GuillaumeLoup/3c8bc33aba99ae85cf63c3d962689779 to your computer and use it in GitHub Desktop.
Save GuillaumeLoup/3c8bc33aba99ae85cf63c3d962689779 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 person1 = new person("John", 40);
const person2 = new person("Mary", 35);
console.log(person1.tellMyName());
console.log(person1.tellMyAge());
console.log(person2.tellMyName());
console.log(person2.tellMyAge());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment