Advertisement
-Annie-

02.PersonClass

Jul 10th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Person {
  2.     constructor(firstName, lastName, age, email){
  3.         this.firstName = firstName;
  4.         this.lastName = lastName;
  5.         this.age = age;
  6.         this.email = email;
  7.     }
  8.  
  9.     toString(){
  10.         return `${this.firstName} ${this.lastName} (age: ${this.age}, email: ${this.email})`;
  11.     }
  12. }
  13.  
  14. let person = new Person('Maria', 'Petrova', 22, 'mp@yahoo.com');
  15. console.log(person.toString());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement