Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 1.challenge.POO)
- class person{
- constructor(name, age){
- this.name = name;
- this.age= age;
- }
- tellMyName(){
- return this.name,
- console.log(`I am ${this.name}`);
- }
- tellMyAge(){
- return this.age,
- console.log(`I am ${this.age} years old`);
- }
- }
- const John = new person("John",40);
- const Mary = new person("Mary",35);
- John.tellMyName(), John.tellMyAge()
- Mary.tellMyName(), Mary.tellMyAge()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement