Question: in HTML - Create a Shape class with three properties: name, sides, and sideLength. - Add a constructor to this class. The constructor takes arguments

in HTML
 in HTML - Create a Shape class with three properties: name,

- Create a Shape class with three properties: name, sides, and sideLength. - Add a constructor to this class. The constructor takes arguments for the name, sides, and sideLength properties, and initializes them. - Add a new method calcPerimeter() method to the class, which calculates its perimeter (the length of the shape's outer edge) and logs the result to the console. - Create a new instance of the Shape class called square. Give it a name of square and a sideLength of 5. - Call your calcPerimeter0 method on the instance, to see whether it logs the calculation result to the browser's console as expected. - Create a new instance of Shape called triangle, with a name of triangle and a sideLength of 3 . - Call triangle.calcPerimeter( to check that it works fine. Aid: https://www.codecademy.com/forum_questions/55a1697476b8fee1ec000154

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!