From 75b8f47e561c8326845a85f0cc4071b8c99a18ce Mon Sep 17 00:00:00 2001 From: LSvekis Date: Tue, 22 Jun 2021 15:51:34 -0400 Subject: [PATCH] Create ex 2 --- chapter7/ex 2 | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 chapter7/ex 2 diff --git a/chapter7/ex 2 b/chapter7/ex 2 new file mode 100644 index 0000000..bb40ac0 --- /dev/null +++ b/chapter7/ex 2 @@ -0,0 +1,13 @@ +class Person { + constructor(firstname, lastname) { + this.firstname = firstname; + this.lastname = lastname; + } + fullname(){ + return this.firstname + " " + this.lastname; + } +} +let person1 = new Person("Maaike", "van Putten"); +let person2 = new Person("Laurence", "Svekis"); +console.log(person1.fullname()); +console.log(person2.fullname());