Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. class Person{
  2. constructor(name, age){
  3. this.tellMyName = name;
  4. this.tellMyAge = age;
  5. }
  6. tellName(){
  7. return `I am ${this.tellMyName}, `
  8. }
  9. tellAge(){
  10. return `and ${this.tellMyAge} years old.`
  11. }
  12.  
  13. } // Fin classe
  14.  
  15. let john = new Person('John', 40);
  16. let mary = new Person('Mary', 35);
  17.  
  18.  
  19. console.log(`${john.tellName()}${john.tellAge()}`)
  20. console.log(`${mary.tellName()}${mary.tellAge()}`)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement