Skip to content

Instantly share code, notes, and snippets.

@BastienSaulnier
Created October 4, 2019 10:03
Show Gist options
  • Save BastienSaulnier/d2b73c3334ff47170bdd644db7b1c4d0 to your computer and use it in GitHub Desktop.
Save BastienSaulnier/d2b73c3334ff47170bdd644db7b1c4d0 to your computer and use it in GitHub Desktop.
Wild Code School - POO en JS - 1
class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}
tellMyName() {
console.log(`I am ${this.name}`);
}
tellMyAge() {
console.log(`I am ${this.age}`);
}
;}
john = new Person('John', 40);
mary = new Person('Mary', 35);
mary.tellMyName();
mary.tellMyAge();
console.log('And');
john.tellMyName();
john.tellMyAge();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment