SHARE
TWEET

Untitled

a guest Oct 18th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class person {
  2.    
  3.     constructor(name, age) {
  4.         this.name = name;
  5.         this.age = age;
  6.     }
  7.    
  8.     tellMyName() {
  9.         return `I am ${this.name}`;
  10.  
  11.     }
  12.  
  13.     tellMyAge() {
  14.         return `I am ${this.age} years old`;
  15.     }
  16.   }
  17.  
  18. const john = new person ("john", 40);
  19. const marie = new person ("marie", 35);
  20.  
  21. console.log(john.tellMyName());
  22. console.log(john.tellMyAge());
  23.  
  24. console.log(marie.tellMyName());
  25. console.log(marie.tellMyAge());
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top