NOTE: You can ignore the
module is not defined
error you see in the console when openingindex.html
in the browser. You should still be able to test your code.
Define a Rectangle
class. Its constructor should take a length
and width
as arguments.
Augment the class with the following methods...
isSquare
- returns true if the rectangle is a square.area
- calculates the area of the rectangle.perimeter
- calculates the perimeter of the rectangle.
Create a few rectangles with different lengths and widths.
Bonus: Test your outcomes using Jasmine!
Define a Triangle
class. Its constructor should take three sides -- sideA
sideB
and sideC
-- as arguments.
Augment the class with the following methods...
isEquilateral
- returns true if the triangle is equilateral.isIsosceles
- return true if the triangle is isosceles.area
- calculates the area of the Triangle.isObtuse
- returns true if the triangle is obtuse.
Create a few rectangles with different lengths and widths.
Bonus: Test your outcomes using Jasmine!
Define a LineSegment
class. Its constructor should take two pairs of coordinates -- x1
y1
x2
y2
-- as arguments.
Augment the class with the following method...
length
– calculates the length of the (x1, y1) --> (x2, y2) line segment.