SHARE
TWEET

Untitled

a guest Oct 21st, 2019 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Person {
  2.  
  3.     constructor(name,age){
  4.  
  5.     this._name = name;
  6.     this._age = age;
  7.  
  8.     }
  9.  
  10.     tellMyName() {
  11.  
  12.         console.log(`I am ${this._name}`)
  13.    
  14.     }
  15.  
  16.     tellMyAge() {
  17.  
  18.         console.log(`I am ${this._age} years old`)
  19.  
  20.     }
  21. }
  22.  
  23. const John = new Person ('John',40)
  24. John.tellMyName();
  25. John.tellMyAge();
  26.  
  27. const Mary = new Person ('Mary', 35)
  28. Mary.tellMyName();
  29. 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