alexlucas83
3/18/2019 - 10:56 AM

poo js1

class person {
    constructor(name, age){
        this.name = name;
        this.age = age;
    }
    tellMyName(){
        return `I am ${this.name}`;
    }
    tellMyAge(){
        return `I am ${this.age} years old`;
    }
}    
const person1 = new person("john", 40);
console.log(`${person1.tellMyName()} ${person1.tellMyAge()}`);

const person2 = new person("mary",35);
console.log(`${person2.tellMyName()} ${person2.tellMyAge()}`);