Guest User

Untitled

a guest
Oct 18th, 2019
94
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Person {
  2. constructor(name, age) {
  3. this.age = age;
  4. this.name = name;
  5. }
  6. tellMyName(){
  7. return `I am ${this.name}`;
  8. }
  9. tellMyAge(){
  10. return `I am ${this.age} years old`;
  11. }
  12. };
  13.  
  14. let person1 = new Person("Jhon", 40);
  15. let person2 = new Person("Mary", 35);
  16.  
  17. console.log(person1.tellMyName(),person1.tellMyAge());
  18. console.log(person2.tellMyName(),person2.tellMyAge());
RAW Paste Data