Challenge: Constructor Pattern

In this challenge, you have to implement a constructor pattern to solve the given problem.

We'll cover the following

Problem statement

The example in the previous lesson used the constructor functions version code of a “constructor pattern”. The same code is given in the testing widget below. Your task is to convert it to the ES6 version.

Note: We have ignored the describe function in this challenge.

Input

The given code

Output

ES6 version of classes implemented

Challenge #

Take a close look and design a step-by-step solution before jumping on to the implementation. This problem is designed for your practice, so try to solve it on your own first. If you get stuck, you can always refer to the solution provided. Good Luck!

function Human(name, age, occupation){
this.name = name;
this.age = age;
this.occupation = occupation;
}

Let’s discuss the solution in the next lesson.