SHARE
TWEET

Untitled

a guest Oct 18th, 2019 87 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.   getName(){
  7.     console.log("i am "+ this.name);
  8.   }
  9.   getAge(){
  10.     console.log("I am "+ this.age+" years old.");
  11.   }
  12. }
  13.  
  14. const person1 = new Person("Jhon", 25);
  15. const person2 = new Person( "Mary", 45);
  16.  
  17. person1.getName() + person1.getAge()
  18. person2.getName() + person2.getAge()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top