Search⌘ K

Exercise 2: Finding the Type of Triangle

Explore how to implement class-based inheritance in JavaScript by extending a Shape constructor to a Triangle constructor. Learn to initialize properties, inherit prototype methods, and create functions to determine triangle types like Equilateral, Isosceles, and Scalene.

Problem Statement

In this exercise, two constructor functions, Shape and Triangle are declared. You need to implement class-based inheritance such that the class Triangle inherits prototype properties from the Shape class.

You have to implement the following tasks:

Task 1

  • Pass the parameters name and sides ...