Geometry Function Lab/Homework

Please create a javascript file in this repository that fulfills the following requirements. This assignment is due Tuesday morning at 9am. Turn it in via a Github Pull Request.

Part 1, Rectangle

Given the following a rectangle object like the one below, write the following functions:

  • isSquare - Returns whether the rectangle is a square or not
  • area - Returns the area of the rectangle
  • perimeter - Returns the perimeter of the rectangle
var rectangle = {
  length: 4,
  width: 4
};

Part 2, Triangle

Given the following a triangle object like the one below, write the following functions:

  • isEquilateral - Returns whether the triangle is equilateral or not
  • isIsosceles - Returns whether the triangle is isosceles or not
  • area - Returns the area of the Triangle
  • isObtuse - Returns whether the triangle is obtuse or not
var triangle = {
  sideA: 3,
  sideB: 4,
  sideC: 4
};

Optional Bonus

Geometry shapes aren't fun if you can't see them.

Use the Raphaël javascript library to draw the shapes on screen. We haven't explained how to do this, but if you're looking for a challenge, here ya go!