Advertisement
sibelkoc

Untitled

Nov 13th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Person {
  2.     constructor(name, age){
  3.         this.name =name;
  4.         this.age = age;
  5.     })
  6.  
  7.     tellMyName(){
  8.         retun `I am ${name}`;
  9.     }
  10.     tellMyAge(){
  11.         return `I am ${name} years old`;
  12.     }
  13. }
  14.     let Person1 = new Person('John', 40);
  15.     let Person2 = new Person('Mary', 35);
  16.     console.log(Person1.tellMyName() + ' and ' + Person1.tellMyAge());
  17.     console.log(Person2.tellMyName() + ' and ' + Person2.tellMyAge());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement