1 min to read

# 10 Days of JavaScript Day 4: Rectangle Object & Classes

Day 4 of 10 Days of JavaScript challenge on Hackerrank is Create a Rectangle Object & Classes and Count Objects.

In this series, I will be sharing my solutions to the challenges.

## Day 4: Create a Rectangle Object

Function has two parameters: `a`

and `b`

. It must return an object modeling a rectangle that has the following properties:

- length: This value is equal to
`a`

. - width: This value is equal to
`b`

. - perimeter: This value is equal to
`2 * (a + b)`

- area: This value is equal to
`a * b`

### Input Format

- The first line contains an integer denoting .
- The second line contains an integer denoting .

## Day 4: Classes

Create a Polygon class that has the following properties:

- A constructor that takes an array of integer values describing the lengths of the polygon’s sides.
- A
`perimeter()`

method that returns the polygon’s perimeter.

## Day 4: Count Objects

`getCount`

has the following parameter:

`objects`

: an array of objects with integer properties`x`

and`y`

.- The function must return a count of all such objects
`o`

in array`objects`

that satisfy`o.x == o.y`

.