Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. class Person {
  2. constructor(name, age) {
  3. this.age = age;
  4. this.name = name;}
  5.  
  6. tellMyName(name){
  7. console.log (`i'm ${this.name}`)}
  8.  
  9. tellMyAge(age){
  10. console.log (`i'm ${this.age} years old`)}
  11. }
  12. let John = new Person("john",40);
  13. let Mary = new Person("mary",35)
  14.  
  15. John.tellMyName();
  16. John.tellMyAge();
  17. Mary.tellMyAge();
  18. Mary.tellMyName();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement