Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Person{
- constructor(name, age){
- this.tellMyName = name;
- this.tellMyAge = age;
- }
- tellName(){
- return `I am ${this.tellMyName}, `
- }
- tellAge(){
- return `and ${this.tellMyAge} years old.`
- }
- } // Fin classe
- let john = new Person('John', 40);
- let mary = new Person('Mary', 35);
- console.log(`${john.tellName()}${john.tellAge()}`)
- console.log(`${mary.tellName()}${mary.tellAge()}`)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement