SHARE
TWEET

Untitled

a guest Oct 18th, 2019 66 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. tellMyAge () {
  13. return  ` I am ${this.age} years old`;
  14. }
  15. }
  16.  
  17.  
  18. const john = new Person("john", 40);
  19. const mary  = new Person("mary", 35);
  20.  
  21.  
  22. console.log(john.tellMyName());
  23. console.log(john.tellMyAge());
  24.  
  25. console.log(mary.tellMyName());
  26. console.log(mary.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