Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. // 1.challenge.POO)
  2.  
  3. class person{
  4. constructor(name, age){
  5. this.name = name;
  6. this.age= age;
  7. }
  8. tellMyName(){
  9. return this.name,
  10. console.log(`I am ${this.name}`);
  11. }
  12.  
  13. tellMyAge(){
  14. return this.age,
  15. console.log(`I am ${this.age} years old`);
  16. }
  17.  
  18.  
  19.  
  20. }
  21.  
  22. const John = new person("John",40);
  23. const Mary = new person("Mary",35);
  24.  
  25. John.tellMyName(), John.tellMyAge()
  26. Mary.tellMyName(), Mary.tellMyAge()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement