Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. class Person {
  2. constructor(name, age) {
  3. this.name = name;
  4. this.age = age;}
  5.  
  6. tellMyName() {console.log('I am ' + this.name);
  7.  
  8. }
  9. tellMyAge() {console.log('I am ' + this.age + ' years old.');
  10.  
  11. }
  12. }
  13.  
  14. const Person1 = new Person('John',40);
  15. const Person2 = new Person('Mary',35);
  16.  
  17. Person1.tellMyName(),Person1.tellMyAge()
  18. Person2.tellMyName(),Person2.tellMyAge()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement