Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Person {
- constructor(firstName, lastName, age, email){
- this.firstName = firstName;
- this.lastName = lastName;
- this.age = age;
- this.email = email;
- }
- toString(){
- return `${this.firstName} ${this.lastName} (age: ${this.age}, email: ${this.email})`;
- }
- }
- let person = new Person('Maria', 'Petrova', 22, 'mp@yahoo.com');
- console.log(person.toString());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement