Objective

In this challenge, we practice creating objects. Create a object with given length, width, perimeter, area.

Task

Complete the function in the editor. It has two parameters:  a and b. It must return an object modeling a rectangle that has the following properties:

  • length : equal to a .
  • width : equal to b.
  • perimeter : equal to 2*(a+b)
  • area: equal to a*b
function Rectangle(a, b) {
    return {
        length: a,
        width: b,
        perimeter: 2* (a+b),
        area: a*b,
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *