SHARE
TWEET

Untitled

a guest Oct 18th, 2019 115 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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()}`)
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