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