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
- }
- getAge(){
- return this.age;
- }
- getName(){
- return this.name
- }
- tellMyName(){
- console.log(`I am ${this.name}`)
- }
- tellMyAge(){
- console.log(` I have ${this.age} years old`)
- }
- }
- const Jhon = new Person('Jhon', 40);
- const Marie = new Person('Mary', 35);
- Jhon.tellMyAge()
- Jhon.tellMyName()
- Marie.tellMyAge()
- Marie.tellMyName()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement