Advertisement
Guest User

Untitled

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