Challenge: Constructor Pattern

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

We'll cover the following

Problem statement

The example in the previous lesson used the constructor functions to implement the “constructor pattern”. Similarly, a constructor function for Shape is provided to you in the code widget below. In this challenge, your task is to convert it to the ES6 version.

Input

The given code

Output

ES6 version of classes implemented

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.